❔ Deploying a dotnet core application with Docker
I'm mostly used to building NodeJS applications where during development, I keep all "secrets" and appsettings in a
.env
file that gets loaded.
When deploying to production, I just have to make sure that all the environment variables are set, and the application will work.
Now, building a dotnet application I feel like this stuff is spread out a bit, and I don't know where I should put this stuff and how I should do it in production.
For example: my Auth clientId/clientSecret is added by doing dotnet user-secrets set ....
, but my connectionString for my postgres database is in appsettings.json
. I've tried googling this but I haven't had any luck finding any good answers.2 Replies
So.. what is the question? If you are using
Microsoft.Extensions.Configuration
(as you probably are) then all of these sources (appsettings.json
, env variables, user secrets) are equal, you are free to use all of them.
Personally I store all non-sensitive configs in appsettings and include it in repository, all others are kept in env-vars in my IDEWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.