commit a60a1c626a79ed8748a49b3e6f205353af86427b
parent ff0f6c6cf5192f715fc5b2d4f36ac46385a6470a
Author: Carlosokumu <carlosokumu254@gmail.com>
Date: Wed, 5 Nov 2025 21:37:10 +0300
feat: add load for object stores
Diffstat:
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/ungana/config.py b/ungana/config.py
@@ -1,14 +1,27 @@
import os
import confini
from xdg.BaseDirectory import save_data_path
+import logging
__datadir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data")
+logger = logging.getLogger(__name__)
def load():
cfg = confini.Config(__datadir)
cfg.process()
- if not cfg.get('BASE_DATAPATH', None):
- datapath = save_data_path('ungana')
- cfg.add(datapath, 'BASE_DATAPATH')
-
- return cfg
+
+ if "BASE_DATAPATH" in cfg.store:
+ datapath = cfg.get("BASE_DATAPATH")
+ else:
+ datapath = save_data_path("ungana")
+ cfg.add(datapath, "BASE_DATAPATH")
+
+ if "BASE_OBJ_STORES" in cfg.store:
+ storage_locations = cfg.get("BASE_OBJ_STORES")
+ if isinstance(storage_locations, str):
+ storage_locations = storage_locations.replace(",", " ").split()
+ cfg.add(storage_locations, "OBJ_STORES")
+ else:
+ logger.warning("No obj_stores defined in configuration file")
+
+ return cfg
+\ No newline at end of file