Is there a way to change the default environment?

Hi, I finding a way to change the default path of environment file.

As you all know phoenix has a default environment dev.exs.

I just want to make my environment file(ex: stg.exs) and want to start with mix phx.server
not MIX_ENV=stg mix phx.server

Is there a way to change the path of evironment?

See the docs:

When running Mix via the command line, you can configure the default environment or the preferred environment per task via the def cli function in your mix.exs. For example:

def cli do
  [
    default_env: :local,
    preferred_envs: [docs: :docs]
  ]
end
2 Likes