Can Render provided ENVs be used to set our ENV?

We have an ENV that is synonymous with Render’s provided RENDER_EXTERNAL_URL. We could change our setup / code to use that ENV, but for the time being, I would prefer to just set our ENV to the value of the RENDER_EXTERNAL_URL. Is that possible?

1 Like

Hi there,

Thanks for reaching out.

There isn’t currently any sort of dynamic environment variable interpolation features (but there are feature requests).

However, you may be able to achieve a workaround/something similar with standard bash. For example, you could add something like this before your build/start command:

MY_EXTERNAL_DOMAIN="${MY_EXTERNAL_DOMAIN:-$RENDER_EXTERNAL_HOSTNAME}" start_or_build_command_here;

This will set MY_EXTERNAL_DOMAIN to RENDER_EXTERNAL_HOSTNAMEunless MY_EXTERNAL_DOMAIN is set in your environment variables tab, which you may want to do if adding a custom domain later.

And to make that a bit tidier & tracked in code, you could create shell scripts in your repo for the build/start commands, to set the dynamic cars you need.

Hope that helps

Alan

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.