Skip to content

Instantly share code, notes, and snippets.

@fernandolopes
Created May 18, 2021 17:40
Show Gist options
  • Select an option

  • Save fernandolopes/e0be9d1fbe89224c01607dd759b45a50 to your computer and use it in GitHub Desktop.

Select an option

Save fernandolopes/e0be9d1fbe89224c01607dd759b45a50 to your computer and use it in GitHub Desktop.
appsettings.Development.json
public class InjectorData
{
public static void RegisterServices(IConfiguration Configuration, IServiceCollection services)
{
//Database
string conn = Configuration.GetConnectionString("SQLDatabase");
var username = Environment.GetEnvironmentVariable("username");
var password = Environment.GetEnvironmentVariable("password");
var host = Environment.GetEnvironmentVariable("HOST");
conn = $"Host={host};User ID={username};Password={password};{conn}";
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(host))
{
throw new ArgumentNullException("conn");
}
.
.
.
}
}
{
"ConnectionStrings": {
"SQLDatabase": "Port=5432;Database=Nome-do-banco;Persist Security Info=False;TrustServerCertificate=False;"
},
"Logging": {
"Debug": {
"LogLevel": {
"Default": "Trace"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment