So I am having to deploy into Azure for this project. After we finally have most things working it looks like I have been supplied Azure environment variables to use for the database connection. What is the best way to use these as I know by default the .env file is not tracked by git and is usually the place to store this info. Should I modify the database config and throw a bunch of ifs in there to see if the azure stuff is set and use that if so?
#Deployment to Azure, using Azure environment variables for database?
6 messages · Page 1 of 1 (latest)
It should just work, any env-variables set in the environment will override the ones in .env
I.e. your config file still references env('DB_PASSWORD') etc
I mean, assuming you do set these as environment variables in App Service (or whatever Azure service you're using).
Yep that's right. Good to know they will override from there then (If only we were using the same names) - Ended up using some inline ifs to check if they were set and use
.env files are just replacements for actual environment variables. You should be setting and using environment variables where you can.