simpliest_fs/config.py

20 lines
344 B
Python

import os
import yaml
CONFIG = {}
STORAGE_ROOT = ""
def load_config():
global CONFIG, STORAGE_ROOT
with open("config.yaml", "r") as f:
CONFIG = yaml.safe_load(f)
STORAGE_ROOT = CONFIG["storage"]["root_dir"]
os.makedirs(STORAGE_ROOT, exist_ok=True)
return CONFIG
def get_storage_root():
return STORAGE_ROOT