I was looking at the environment variables for an App I created in the App Platform with a PostgreSQL database and that the DATABASE_URL is available during build time:

Your component will have access to these variables at both build time and runtime.

However, when trying to access it during the build it wasn’t available. I also downloaded the YAML spec for the app where the scope was set to RUN_TIME

Is there a way to configure DATABASE_URL to be available during build time via the UI?

The only way I can think of doing this is downloading the spec, updating the scope, and then updating the app with the doctl.

Besides that, could the availability of the DATABASE_URL env var be better clarified in the UI to avoid confusion?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

đź‘‹ @danielnorman

Currently there is not a way for DATABASE_URL (or any other database bind variables) to be available during build.

We plan on supporting build time access to databases soon though we don’t have a specific timeline just yet.