Environment variables and docker
# help-with-umbraco
i
Hi all, I've been working to containerize my first Umbraco site(and first real container in general) and its been going super good so far. However, when I locally run my application with the environment variables as following:
Copy code
CONNECTIONSTRINGS__UMBRACODBDSN_PROVIDERNAME="Microsoft.Data.SqlClient"
CONNECTIONSTRINGS__UMBRACODBDSN="Server=xxxxxx.database.windows.net;Database=xxxxxx;User ID=xxxxxxx;Password=xxxxxxxxxxx"
it works. However, in my container I get a 'login failed for user xxx'. The environment variables should be exactly the same. Anyone has experience with this?
My host is Windows, and my containers are run in WSL, and in production on linux. Does this have anything to do with case sensitivity maybe?
Nope, casing didn't change it
Okay this was a nasty one. My connection string password contains all kinds of characters. Environment variables in docker are read and replacement can happen in strings if they are DOUBLE quoted. Not single quoted.
E.g.
Copy code
CONNECTIONSTRINGS__UMBRACODBDSN='Password=Test1234$tesfrsd$FLJ'
Would get changed to whatever, but kind of this:
Copy code
CONNECTIONSTRINGS__UMBRACODBDSN='Password=Test1234$%FLJ'
So if you have dollar signs in environment variables, USE SINGLE QUOTES! Thanks for listening to my rant
9 Views