feat: allow specifying database password in separate config parameter
This commit is contained in:
parent
9dd3fba7e6
commit
b75e59da2f
@ -5,6 +5,7 @@ namespace PluralKit.Core;
|
||||
public class CoreConfig
|
||||
{
|
||||
public string Database { get; set; }
|
||||
public string? DatabasePassword { get; set; }
|
||||
public string RedisAddr { get; set; }
|
||||
public bool UseRedisMetrics { get; set; } = false;
|
||||
public string SentryUrl { get; set; }
|
||||
|
@ -35,7 +35,7 @@ internal partial class Database: IDatabase
|
||||
_migrator = migrator;
|
||||
_logger = logger.ForContext<Database>();
|
||||
|
||||
_connectionString = new NpgsqlConnectionStringBuilder(_config.Database)
|
||||
var connectionString = new NpgsqlConnectionStringBuilder(_config.Database)
|
||||
{
|
||||
Pooling = true,
|
||||
Enlist = false,
|
||||
@ -43,7 +43,12 @@ internal partial class Database: IDatabase
|
||||
|
||||
// Lower timeout than default (15s -> 2s), should ideally fail-fast instead of hanging
|
||||
Timeout = 2
|
||||
}.ConnectionString;
|
||||
};
|
||||
|
||||
if (_config.DatabasePassword != null)
|
||||
connectionString.Password = _config.DatabasePassword;
|
||||
|
||||
_connectionString = connectionString.ConnectionString;
|
||||
}
|
||||
|
||||
private static readonly PostgresCompiler _compiler = new();
|
||||
|
Loading…
Reference in New Issue
Block a user