I borrowed the below from here. I have very little in the app specific configs. Just the things that clash, e.g. swoosh and sentry.
defp releases do
target = target()
[
localapp: [
include_executables_for: executables(target),
applications: [runtime_tools: :permanent, localapp: :permanent],
steps: steps(target),
rel_templates_path: "apps/localapp/rel"
],
cloudapp: [
include_executables_for: [:unix],
applications: [runtime_tools: :permanent, cloudapp: :permanent],
steps: steps(:unix),
rel_templates_path: "apps/cloudapp/rel",
config_providers: config_providers_for_apps([:cloudapp])
]
]
end
# Add the runtime.exs configuration for each provided app
defp config_providers_for_apps(apps) do
for app <- apps do
{Config.Reader,
path: {:system, "RELEASE_ROOT", "/apps/#{app}/config/runtime.exs"}, env: Mix.env()}
end
end
# When assembling the release, we copy all the runtime.exs files defined in `config_providers` to it,
# keeping the relative app path to avoid collisions.
defp copy_configs(%Mix.Release{path: release_dir, config_providers: config_providers} = release) do
for {_module, path: {_context, _root, config_file_path}, env: _} <- config_providers do
config_dir = Path.join(release_dir, Path.dirname(config_file_path))
# Clean the config directory to make sure we are only including the files defined in the config_providers
File.rm_rf!(config_dir)
File.mkdir_p!(config_dir)
File.cp!(
Path.relative(config_file_path),
Path.join(config_dir, Path.basename(config_file_path))
)
end
release
end