updates
This commit is contained in:
@@ -26,13 +26,12 @@ class Config:
|
||||
self.header_image = 'static/header.jpg'
|
||||
self.site_name = f"{self.app_name} library"
|
||||
self.theme = "default"
|
||||
self.debug = False
|
||||
if os.path.isfile (self.config_path):
|
||||
with open(self.config_path, "r") as f:
|
||||
config = yaml.safe_load(f)
|
||||
if config:
|
||||
self.update_from_dict(config)
|
||||
else:
|
||||
self.create_default_config()
|
||||
|
||||
def update_from_dict(self, config_dict):
|
||||
for key, value in config_dict.items():
|
||||
@@ -44,7 +43,8 @@ class Config:
|
||||
def create_default_config(self):
|
||||
defaults = {
|
||||
"site_name": self.site_name,
|
||||
"theme": "default"
|
||||
"theme": "default",
|
||||
"debug": False
|
||||
}
|
||||
with open(self.config_path, mode="w", encoding="utf-8") as f:
|
||||
yaml.safe_dump(defaults, f)
|
||||
|
||||
Reference in New Issue
Block a user