Runtime configuration for a dependent library

Not only that, but it is generally discouraged to use the config for libraries (see the infobox at Config — Elixir v1.16.2).

I personally consider one’s “internal” dependencies to be an exception, and so this is my approach to runtime config for such libraries:

in the main app’s runtime.exs:

[SubApp1.RuntimeConfig]
|> Enum.each(&apply(&1, :config))

in the dependency (at lib/runtime_config.exs):

defmodule SubApp1.RuntimeConfig do
  def config do
    import Config
    
    config :sub_app1,
    	key: System.get_env("SUB_APP1_key", "default_val")