Reading parent app config from an umbrella app

I’m structuring an application using an umbrella app, as of now there are 2 apps

  • web: handling auth and api endpoints
  • backend (not really called backend) running application logic

both have ecto installed, what I wanted to do is to use ecto prefixes to separated the two apps but having a common database setting.

For example, in my root app I have

config :app, :database_url, System.get_env("DATABASE_URL") || "postgres://localhost/app"

and in my sub-apps I’ve tried with

config :app_backend, App.Backend.Repo,
  adapter: Ecto.Adapters.Postgres,
  url: Application.get_env(:app, :database_url)

however it always returns nil, is there a way to solve this?

2 Likes