Add in-app connection string settings
This commit is contained in:
parent
47bdc34142
commit
18ac9f882d
@ -25,6 +25,7 @@ namespace PluralKit.Core
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IMetrics _metrics;
|
private readonly IMetrics _metrics;
|
||||||
private readonly DbConnectionCountHolder _countHolder;
|
private readonly DbConnectionCountHolder _countHolder;
|
||||||
|
private readonly string _connectionString;
|
||||||
|
|
||||||
public Database(CoreConfig config, DbConnectionCountHolder countHolder, ILogger logger,
|
public Database(CoreConfig config, DbConnectionCountHolder countHolder, ILogger logger,
|
||||||
IMetrics metrics)
|
IMetrics metrics)
|
||||||
@ -33,6 +34,11 @@ namespace PluralKit.Core
|
|||||||
_countHolder = countHolder;
|
_countHolder = countHolder;
|
||||||
_metrics = metrics;
|
_metrics = metrics;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
|
_connectionString = new NpgsqlConnectionStringBuilder(_config.Database)
|
||||||
|
{
|
||||||
|
Pooling = true, MaxPoolSize = 500, Enlist = false, NoResetOnClose = true
|
||||||
|
}.ConnectionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InitStatic()
|
public static void InitStatic()
|
||||||
@ -76,7 +82,7 @@ namespace PluralKit.Core
|
|||||||
|
|
||||||
// Create a connection and open it
|
// Create a connection and open it
|
||||||
// We wrap it in PKConnection for tracing purposes
|
// We wrap it in PKConnection for tracing purposes
|
||||||
var conn = new PKConnection(new NpgsqlConnection(_config.Database), _countHolder, _logger, _metrics);
|
var conn = new PKConnection(new NpgsqlConnection(_connectionString), _countHolder, _logger, _metrics);
|
||||||
await conn.OpenAsync();
|
await conn.OpenAsync();
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user