As mentioned, adding the domains to the config would be a good solution.
For things that don’t go cleanly into the config or where you need to run different code paths based on Mix env, I use this in my config.exs:
# Store mix env used to compile app, since Mix won't be available in release
config :code_stats, compile_env: Mix.env()
This way I can use Application.get_env(:code_stats, :compile_env) and it will work inside and outside releases, and will reflect the env the app was compiled with.
Still, testing specific environment names sounds like very poor form though, wouldn’t it be better to put a binding in a config file and just access that instead?