I’d like to get the release-name during mix release build, so I can do something smart in my config.exs. I see the release name is available at runtime via System.get_env(“RELEASE_NAME”), but it looks like the onlyway I can get a populated %Mix.Release{} is via step function.
Shouldn’t the release name be the same as your application name?
You also get access to the Mix.Release struct in the generated rel/*.eex template files.
Can you talk a bit more about your exact use case?
If you don’t specify :releases
key (you can have many releases) in your mix.exs file then yes, the app name would be the default release name.
Thanks, here’s my dummed down use case. I have four different releases, each release is deployed to connect to a different backend database. What I’m looking for is in my config/config.exs is to have something like
import_config "#{Mix.release_name()}/db_config.exs"
Also, I really want to rename config/config.exs to config/buildtime_config.exs, and config/releases.exs to config/runtime_config.exs.
Got it, I’m not sure such can be achieved today without using RELEASE_NAME
env var.
If this configuration is for DB settings and such, perhaps you could build a single release and control these using env variables?
Also, I really want to rename config/config.exs to config/buildtime_config.exs, and config/releases.exs to config/runtime_config.exs.
You should be able to do this by setting in mix.exs:
def project() do
[
config_path: "config/buildtime_config.exs",
releases: [
foo: [
runtime_config_path: "config/runtime_config.exs"
]
]
]
end