Report this

What is the reason for this report?

How to use environment variables specified in the app spec as values for fields inside the app spec?

Posted on November 1, 2021

Lets say you have specified an encrypted app wide environment variable in the app spec. Now you wish to use this environment variable as a value for a field inside the app spec. Is it possible?

Concrete example: I wish to forward logs to Logtail. In order to do that, I need to set up log_destinations and provide a token. I don’t wish to upload the token to version control, and thus instead specify the token as an encrypted app wide environment variable. Is it possible to somehow use this same environment variable as value for the “token” field?

If not, is there a way to inject environment variables into the app spec file e.g. from github environment variables?



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!

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!

This is a good idea, but unfortunately not something that App Platform supports. ENV variables would only be available within the application itself and not readable by the app spec file. I would suggest adding it to our ideas page: DigitalOcean Ideas

You possibly could create those variables outside of version control on your local machine or use Github variables to store them. You could then write your own script to generate your app spec with those variables and deploy your app with DOCTL

Hope it helps! Nate

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Dark mode is coming soon.