mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-20 16:22:27 +00:00
Add DbConnectionString to config
This commit is contained in:
parent
76aeb54da0
commit
177befde91
4 changed files with 5 additions and 14 deletions
|
@ -8,7 +8,7 @@ namespace LBPUnion.ProjectLighthouse.Tests
|
|||
{
|
||||
public DatabaseFact()
|
||||
{
|
||||
ServerStatics.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
|
||||
ServerSettings.Instance.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
|
||||
if (!ServerStatics.DbConnected)
|
||||
{
|
||||
this.Skip = "Database not available";
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace LBPUnion.ProjectLighthouse
|
|||
public DbSet<RatedLevel> RatedLevels { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||
=> options.UseMySql(ServerStatics.DbConnectionString, MySqlServerVersion.LatestSupportedServerVersion);
|
||||
=> options.UseMySql(ServerSettings.Instance.DbConnectionString, MySqlServerVersion.LatestSupportedServerVersion);
|
||||
|
||||
public async Task<User> CreateUser(string username)
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings
|
|||
[NotNull]
|
||||
public static ServerSettings Instance;
|
||||
|
||||
public const int CurrentConfigVersion = 1;
|
||||
public const int CurrentConfigVersion = 2;
|
||||
|
||||
[JsonPropertyName("ConfigVersionDoNotModifyOrYouWillBeSlapped")]
|
||||
public int ConfigVersion { get; set; } = CurrentConfigVersion;
|
||||
|
@ -80,5 +80,7 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings
|
|||
public string InfluxToken { get; set; } = "";
|
||||
|
||||
public string EulaText { get; set; } = "";
|
||||
|
||||
public string DbConnectionString { get; set; } = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
|
||||
}
|
||||
}
|
|
@ -16,17 +16,6 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings
|
|||
|
||||
public const string ServerName = "ProjectLighthouse";
|
||||
|
||||
private static string? dbConnectionString;
|
||||
|
||||
public static string DbConnectionString {
|
||||
get {
|
||||
if (dbConnectionString == null) return dbConnectionString = Environment.GetEnvironmentVariable("LIGHTHOUSE_DB_CONNECTION_STRING") ?? "";
|
||||
|
||||
return dbConnectionString;
|
||||
}
|
||||
set => dbConnectionString = value;
|
||||
}
|
||||
|
||||
public static bool DbConnected {
|
||||
get {
|
||||
try
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue