Setting up preview environments for a web service

Right now, in order to setup a staging environment for my project I have two web services created for my app. One service is tied to the main branch and the other is tied to a staging branch. Each web service has its own set of env vars.

I’m wondering there’s a way to just change the env vars instead of deploying two services.

I’m looking into preview environments using the blueprints, but I have a security concern about this setup.
In the docs about settings up blueprints, it looks like we are to push the render.yml to our source code. Since these blueprints contain env vars with secret keys, is this a secure/safe practice?

Thanks!

Hi Matt,

This community post has a great outline of how to achieve a permanent staging environment, I’d suggest starting there. https://community.render.com/t/suggestions-how-to-have-a-permanent-staging/7280/2

For Preview Environments you can always set an environment variable to sync: false. Using an environment group would be the best approach to provide secrets to Preview Environments. See https://docs.render.com/preview-environments#placeholder-environment-variables for more information on that.

I hope this helps, let me know if you have any additional questions.

Regards,

Matt