Best way of passing arguments with a mix release?

How can I pass command line arguments with a mix release?

Once an elixir application is built using mix release.init followed by MIX_ENV=prod mix release. Is there a way to pass arguments when running _build/prod/rel/prod/bin/prod start.

I was able to do it with bakeware. Can I do it with mix release?

I have an idea that i can do it in rel/vm.args.eex but I don’t know how to do it.


If you mean environment variables as “command line arguments”, it’s a very easy way to do that.

First, you need to create runtime configuration, adding stuff to config/runtime.ex. Then you need to export the environment variable before starting the app

$ export FOO=bar
$ _build/prod/rel/prod/bin/prod start