Angular static site Apps Platform environment variables

On Digital Ocean’s cool Apps platform, I’ve deployed an angular site as a static site and it is deployed after a push to my repo.

I’d like to make calls to an API and so require an API key and secret.

I’ve set environment files in the angular environment.ts files and used the App Platform / {app} / Settings / App-Level Environment Variables to override the environment so I don’t have to commit the secret to my repo.

But it hasn’t worked. The environment key has a scope of RUN_AND_BUILD_TIME

Any clues on how I can get it to override?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Hey there!

In App Platform static sites are served by a CDN and don’t have access to the runtime environment variables. They only have access to build time env variables unfortunately. One workaround to accomplish this is by using a configuration file and a script. An example of how to do this can be found in the answer here.

Hope it helps! Nate