merodi
A markdown-based static site generator.
git clone https://git.pi66.xyz/merodi
About | Files | Commits | Refs | License
feat: add global configuration values to API global store
Author: pi66
Date: 2026-07-25 11:34
commit: a5f6e528
Stat
| M | src/config.py | 6 | +5 | -1 |
Diff
diff --git a/src/config.py b/src/config.py
index 47340df..0ec63a8 100644
--- a/src/config.py
+++ b/src/config.py
@@ -1,4 +1,4 @@
-from os import makedirs, path
+from os import path
from os.path import exists
from tomllib import loads
from .fileops import read_file
@@ -36,9 +36,13 @@ def load_extras_config(c) -> Extras:
def load_cache_config(c) -> Cache:
return Cache(hash=c["cache"]["hash"])
+def load_globals_config(c):
+ api.globals._data.update(c.get("globals", {}))
+
def load_config() -> Config:
raw = read_file("config.toml")
c = loads(raw)
...
Show all
Show less
diff --git a/src/config.py b/src/config.py
index 47340df..0ec63a8 100644
--- a/src/config.py
+++ b/src/config.py
@@ -1,4 +1,4 @@
-from os import makedirs, path
+from os import path
from os.path import exists
from tomllib import loads
from .fileops import read_file
@@ -36,9 +36,13 @@ def load_extras_config(c) -> Extras:
def load_cache_config(c) -> Cache:
return Cache(hash=c["cache"]["hash"])
+def load_globals_config(c):
+ api.globals._data.update(c.get("globals", {}))
+
def load_config() -> Config:
raw = read_file("config.toml")
c = loads(raw)
...
diff --git a/src/config.py b/src/config.py
index 47340df..0ec63a8 100644
--- a/src/config.py
+++ b/src/config.py
@@ -1,4 +1,4 @@
-from os import makedirs, path
+from os import path
from os.path import exists
from tomllib import loads
from .fileops import read_file
@@ -36,9 +36,13 @@ def load_extras_config(c) -> Extras:
def load_cache_config(c) -> Cache:
return Cache(hash=c["cache"]["hash"])
+def load_globals_config(c):
+ api.globals._data.update(c.get("globals", {}))
+
def load_config() -> Config:
raw = read_file("config.toml")
c = loads(raw)
+ load_globals_config(c)
config = Config(
project=load_project_config(c),
tree=load_tree_config(c),