Skip to content

Instantly share code, notes, and snippets.

@noelworden
Created October 1, 2025 22:10
Show Gist options
  • Save noelworden/0c6d7caf112c4161d8b729fbaf8c770d to your computer and use it in GitHub Desktop.
Save noelworden/0c6d7caf112c4161d8b729fbaf8c770d to your computer and use it in GitHub Desktop.
#blog_snippets
defp set_other_secret(_) do
original_config = Application.get_env(:my_app, MyApp.Example)
hash = generate_fake_hash()
updated_config = Keyword.put(original_config, :other_secret, hash)
Application.put_env(:my_app, MyApp.Example, updated_config)
on_exit(fn ->
Application.put_env(:my_app, MyApp.Example, original_config)
end)
{:ok, other_secret: hash}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment