Abstract config design and update logging format (#624)

* Abstract config design and update logging pattern
Also drops legacy config support

* Fix unit tests

* Make backup of config file when upgrading

* Use shared process semaphore to fix migration race conditions

* Use mutex because semaphore isn't supported

* Make startup wait for configs to load

* Move mutex to config load instead of constructor

* Add debug logging

* Make mutex static

* Change mutex name format

* Make mutex use global namespace

* Remove debug logging and fix config upgrading

* Rename lambda variable
This commit is contained in:
Josh 2023-01-10 17:29:47 -06:00 committed by GitHub
parent 7179574e43
commit c86d2a11b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 310 additions and 443 deletions

View file

@ -10,13 +10,10 @@ public sealed class DatabaseFactAttribute : FactAttribute
public DatabaseFactAttribute()
{
ServerConfiguration.Instance = new ServerConfiguration
{
DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse",
};
ServerConfiguration.Instance.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
if (!ServerStatics.DbConnected) this.Skip = "Database not available";
else
lock(migrateLock)
lock (migrateLock)
{
using Database database = new();
database.Database.Migrate();