mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-07 18:24:14 -04:00
Allow "USER" instead of "USER ID" in the configuration
This commit is contained in:
parent
f226b4c8b2
commit
6db43bb19a
@ -9,7 +9,7 @@ services:
|
|||||||
- BASICS__PUBLICURL=http://localhost:5000
|
- BASICS__PUBLICURL=http://localhost:5000
|
||||||
- DATABASE__ENABLED=postgres
|
- DATABASE__ENABLED=postgres
|
||||||
- DATABASE__CONFIGURATIONS__POSTGRES__SERVER=postgres
|
- DATABASE__CONFIGURATIONS__POSTGRES__SERVER=postgres
|
||||||
- DATABASE__CONFIGURATIONS__POSTGRES__USER ID=kyoo
|
- DATABASE__CONFIGURATIONS__POSTGRES__USER=kyoo
|
||||||
- DATABASE__CONFIGURATIONS__POSTGRES__PASSWORD=kyooPassword
|
- DATABASE__CONFIGURATIONS__POSTGRES__PASSWORD=kyooPassword
|
||||||
- TVDB__APIKEY=${TVDB__APIKEY}
|
- TVDB__APIKEY=${TVDB__APIKEY}
|
||||||
- THEMOVIEDB__APIKEY=${THEMOVIEDB__APIKEY}
|
- THEMOVIEDB__APIKEY=${THEMOVIEDB__APIKEY}
|
||||||
|
@ -34,10 +34,21 @@ namespace Kyoo.Database
|
|||||||
/// <returns>A parsed connection string</returns>
|
/// <returns>A parsed connection string</returns>
|
||||||
public static string GetDatabaseConnection(this IConfiguration config, string database)
|
public static string GetDatabaseConnection(this IConfiguration config, string database)
|
||||||
{
|
{
|
||||||
|
static string ToDbProperty(string key)
|
||||||
|
{
|
||||||
|
return key switch
|
||||||
|
{
|
||||||
|
"USER" => "USER ID",
|
||||||
|
_ => key
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
DbConnectionStringBuilder builder = new();
|
DbConnectionStringBuilder builder = new();
|
||||||
IConfigurationSection section = config.GetSection("database:configurations").GetSection(database);
|
IConfigurationSection section = config.GetSection("database:configurations").GetSection(database);
|
||||||
foreach (IConfigurationSection child in section.GetChildren())
|
foreach (IConfigurationSection child in section.GetChildren())
|
||||||
builder[child.Key] = child.Value;
|
{
|
||||||
|
builder[ToDbProperty(child.Key)] = child.Value;
|
||||||
|
}
|
||||||
return builder.ConnectionString;
|
return builder.ConnectionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user