mirror of
https://github.com/rjNemo/vf-site
synced 2026-06-06 01:16:38 +00:00
24 lines
500 B
Python
24 lines
500 B
Python
import tomllib
|
|
from dataclasses import dataclass
|
|
|
|
NAME = "name"
|
|
OUT_DIR = "out_dir"
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Config:
|
|
name: str
|
|
static_files: str
|
|
out_dir: str
|
|
templates_dir: str
|
|
|
|
|
|
def load() -> Config:
|
|
with open("config.toml", "rb") as f:
|
|
raw_config = tomllib.load(f)
|
|
return Config(
|
|
name=raw_config[NAME],
|
|
static_files="assets",
|
|
out_dir=raw_config.setdefault(OUT_DIR, "dist"),
|
|
templates_dir="pages",
|
|
)
|