Skip to content

Instantly share code, notes, and snippets.

@noelworden
Created October 1, 2025 22:07
Show Gist options
  • Select an option

  • Save noelworden/a98024526706d223c32de0f28332fa86 to your computer and use it in GitHub Desktop.

Select an option

Save noelworden/a98024526706d223c32de0f28332fa86 to your computer and use it in GitHub Desktop.

Revisions

  1. noelworden created this gist Oct 1, 2025.
    11 changes: 11 additions & 0 deletions test_envs_04.ex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    defp set_other_secret(_) do
    original_secret = Application.get_env(:my_app, MyApp.Example)[:other_secret]
    hash = fake_hash()
    Application.put_env(:my_app, MyApp.Example, other_secret: hash)

    on_exit(fn ->
    Application.put_env(:my_app, MyApp.Example, other_secret: original_secret)
    end)

    {:ok, other_secret: hash}
    end