Pi66

merodi
A markdown-based static site generator.
git clone https://git.pi66.xyz/merodi

← back to log

feat: add global configuration values to API global store

author: pi66
date: 2026-07-25 11:34
hash: a5f6e5288cdad331ac84437dafd4d8ac72e8cdda

Diffstat:

M

src/config.py
6 +++++++++++++++++++++++++-----
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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),