mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-05-01 21:00:43 +00:00
add yaml config file mvp
This commit is contained in:
parent
2f63cea105
commit
6df77c5b92
2 changed files with 30 additions and 0 deletions
17
open_notebook/config.py
Normal file
17
open_notebook/config.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import os
|
||||
|
||||
import yaml
|
||||
from loguru import logger
|
||||
|
||||
# todo: enable config file overwrite with env vars
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
project_root = os.path.dirname(current_dir)
|
||||
config_path = os.path.join(project_root, "open_notebook_config.yaml")
|
||||
|
||||
try:
|
||||
with open(config_path, "r") as file:
|
||||
CONFIG = yaml.safe_load(file)
|
||||
except Exception:
|
||||
logger.critical("Config file not found, using empty defaults")
|
||||
logger.debug(f"Looked in {config_path}")
|
||||
CONFIG = {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue