Строка подключения ASP.NET в Docker ⇐ C#
-
Гость
Строка подключения ASP.NET в Docker
So, i am trying to connect to my postgres database that is set up in docker.
But i wanted to have a more secure connection string, like a environment variable that will not go to github since this application i want to deploy to azure.
I already tried putting this in my compose, but keep saying that the host can't be null
environment: - "ConnectionStrings__DbContext=User ID=postgres;Password=postgres;Host=app_db;Port=5433;Database=asp;Pooling=true;" this is my app settings
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts": "*", "ConnectionStrings": { "DbContext": "User ID=postgres;Password=postgres;Host=localhost;Port=5433;Database=asp;Pooling=true;" } } and this is my Program.cs
options.UseNpgsql( builder.Configuration["ConnectionStrings:DbContext"] ));
Источник: https://stackoverflow.com/questions/781 ... -in-docker
So, i am trying to connect to my postgres database that is set up in docker.
But i wanted to have a more secure connection string, like a environment variable that will not go to github since this application i want to deploy to azure.
I already tried putting this in my compose, but keep saying that the host can't be null
environment: - "ConnectionStrings__DbContext=User ID=postgres;Password=postgres;Host=app_db;Port=5433;Database=asp;Pooling=true;" this is my app settings
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts": "*", "ConnectionStrings": { "DbContext": "User ID=postgres;Password=postgres;Host=localhost;Port=5433;Database=asp;Pooling=true;" } } and this is my Program.cs
options.UseNpgsql( builder.Configuration["ConnectionStrings:DbContext"] ));
Источник: https://stackoverflow.com/questions/781 ... -in-docker