mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -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)
|
||||
{
|
||||
var connectionString = configuration.GetValue<string>("POSTGRES_URL");
|
||||
|
||||
// Load the connection string from the environment variable, as well as standard libpq environment variables
|
||||
// (PGUSER, PGPASSWORD, PGHOST, PGPORT, PGDATABASE, etc.)
|
||||
NpgsqlConnectionStringBuilder conBuilder =
|
||||
new(configuration.GetValue<string>("POSTGRES_URL") ?? "")
|
||||
{
|
||||
Pooling = true,
|
||||
MaxPoolSize = 95,
|
||||
Timeout = 30
|
||||
};
|
||||
NpgsqlConnectionStringBuilder conBuilder = new(connectionString ?? "");
|
||||
// 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.
|
||||
if (string.IsNullOrEmpty(connectionString))
|
||||
{
|
||||
conBuilder.Pooling = true;
|
||||
conBuilder.MaxPoolSize = 95;
|
||||
conBuilder.Timeout = 30;
|
||||
}
|
||||
|
||||
string? oldVarUsername = configuration.GetValue<string>("POSTGRES_USER");
|
||||
if (!string.IsNullOrEmpty(oldVarUsername))
|
||||
|
Loading…
x
Reference in New Issue
Block a user