Our umbrella application had two releases with no overlapping apps: Our “main release” and our “importer release”. By providing runtime_config_path
in the releases configuration, we created one runtime.exs
file for each of these releases and everything worked perfectly.
Then, we added one common app to both releases, which seems to be a valid use case: mix release — Mix v1.11.3. The problem we are facing now is how to configure the same app in the 2 releases without duplicating configuration across the 2 runtime.exs
files, since that could very easily lead to bugs.
Our initial idea was to create a runtime.exs
config file inside the common app’s config directory and import it in the 2 root runtime configuration files. However, the mix release
documentation says: "It MUST NOT import any other configuration file via import_config
". Trying to understand why is that, we found this comment from @josevalim, explaining that this is discouraged because the other config files are not copied to the release by default. Having understood the rule, we thought we were ready to break it, so we copied the files manually by adding an extra step in the release process and imported it in our runtime.exs
.
However, since v1.11, the “MUST NOT” rule is enforced by code: elixir/config.ex at master · elixir-lang/elixir · GitHub, so it seems that the only way to configure this common app is by duplicating its configuration across both root runtime.exs
files. Is that really the recommended approach?
Has anyone faced this problem and solved it in a different way? I do believe that there should be a way to solve this problem without duplication.