mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 12:14:46 -04:00
Backend: Fix pooling configuration always overriding connection string parameters
This commit is contained in:
parent
454855b299
commit
7d04da2eae
@ -33,15 +33,19 @@ public static class PostgresModule
|
|||||||
{
|
{
|
||||||
public static NpgsqlDataSource CreateDataSource(IConfiguration configuration)
|
public static NpgsqlDataSource CreateDataSource(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
|
var connectionString = configuration.GetValue<string>("POSTGRES_URL");
|
||||||
|
|
||||||
// Load the connection string from the environment variable, as well as standard libpq environment variables
|
// Load the connection string from the environment variable, as well as standard libpq environment variables
|
||||||
// (PGUSER, PGPASSWORD, PGHOST, PGPORT, PGDATABASE, etc.)
|
// (PGUSER, PGPASSWORD, PGHOST, PGPORT, PGDATABASE, etc.)
|
||||||
NpgsqlConnectionStringBuilder conBuilder =
|
NpgsqlConnectionStringBuilder conBuilder = new(connectionString ?? "");
|
||||||
new(configuration.GetValue<string>("POSTGRES_URL") ?? "")
|
// Set defaults when no explicit connection string is provided. This cannot be set if the connection string
|
||||||
{
|
// is provided, or it will override connection string values.
|
||||||
Pooling = true,
|
if (string.IsNullOrEmpty(connectionString))
|
||||||
MaxPoolSize = 95,
|
{
|
||||||
Timeout = 30
|
conBuilder.Pooling = true;
|
||||||
};
|
conBuilder.MaxPoolSize = 95;
|
||||||
|
conBuilder.Timeout = 30;
|
||||||
|
}
|
||||||
|
|
||||||
string? oldVarUsername = configuration.GetValue<string>("POSTGRES_USER");
|
string? oldVarUsername = configuration.GetValue<string>("POSTGRES_USER");
|
||||||
if (!string.IsNullOrEmpty(oldVarUsername))
|
if (!string.IsNullOrEmpty(oldVarUsername))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user