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

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?

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!

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