App Platform - How to use different spec files with secrets for different environments (e.g. testing, staging and production) ?

Posted January 14, 2022 92 views
DeploymentDigitalOcean App Platform

I notice it is possible to associate a particular repo and branch to a DO app, but we cannot configure where to look for a specific spec file.

Furthermore, there is the question on how to handle different secret variables according to the environment.

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


I believe that spec files are mainly useful when you are using the DigitalOcean API or the doctl command-line tool.

In this case you could have different spec files for each environment with a prefix of the specific environment, and use that file for your deployment.

Then you could use the doctl apps create --spec <path-to-spec> command to create your App.

For more information on app specifications I could suggest the documentation here:

Hope that this helps.