[UPD] Added api to create Library

This commit is contained in:
2026-02-15 10:36:37 +01:00
parent bb8324ad1d
commit c468f51672
17 changed files with 142 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
import configparser
from .defaults import default_db_query
from .defaults import default_app_port, default_app_debug
import logging
logger = logging.getLogger(__name__)
@@ -8,9 +9,28 @@ logger = logging.getLogger(__name__)
config = configparser.ConfigParser()
config.read("config.ini")
logger.debug(f"config: {config.sections()}")
if not "DataBase" in config:
config["DataBase"] = default_db_query
def save_config():
with open("config.ini", "w") as f:
f.write(config)
config.write(f)
def check_config():
save = False
if not "DataBase" in config:
logger.debug("DataBase not found in Config")
config["DataBase"] = {
"query": default_db_query
}
save = True
if not "App" in config:
logger.debug("App not found in Config")
config["App"] = {
"port": default_app_port,
"debug": default_app_debug
}
save = True
if save: save_config()
check_config()