add json config and its manager class

+ rewrite logic to prevent removing last admin role
+ handle showing users on login and enabling guest
This commit is contained in:
mungai-njoroge
2024-04-29 16:31:30 +03:00
parent 0ff5661765
commit cfeff7ff51
6 changed files with 234 additions and 23 deletions
+6
View File
@@ -2,6 +2,7 @@
Prepares the server for use.
"""
from dataclasses import asdict
from app.db.sqlite.settings import load_settings
from app.setup.files import create_config_dir
from app.setup.sqlite import run_migrations, setup_sqlite
@@ -9,6 +10,7 @@ from app.store.albums import AlbumStore
from app.store.artists import ArtistStore
from app.store.tracks import TrackStore
from app.utils.generators import get_random_str
from app.config import UserConfig
def run_setup():
@@ -22,6 +24,10 @@ def run_setup():
# settings table is empty
pass
# setup config file
config = UserConfig()
config.setup_config_file()
instance_key = get_random_str()
# INFO: Load all tracks, albums, and artists into memory