bitwalker / distillery

Simplify deployments in Elixir with OTP releases!
MIT License
2.97k stars 398 forks source link

All umbrella app configurations are merged to sys.config instead of only apps specified in release config #573

Closed midas closed 6 years ago

midas commented 6 years ago

It appears that all apps of an umbrella have their configurations merged to sys.config. This can cause issues when some app that is not in use for a release has its config put in place in the respective release.

For instance, a logger backend that is in use for one release but not another in an app. This forces one to include the app that defines the logger backend module even though it will not be in use.

Is there anyway to change this behavior in the distillery config?

Thanks!

bitwalker commented 6 years ago

This is a known issue with Mix config - and unfortunately Distillery doesn't do anything special here, we simply ask Mix to give us the current configuration, which is what gets persisted to sys.config.

That said, this is one of the things you can solve via config providers + using a separate runtime-only config for a given release. Put only compile-time configuration in config/config.exs, and put all runtime config in a dedicated config.exs per-release. For running under Mix, you could conditionally include the runtime config based on MIX_ENV or some other useful bit of environmental context.