mirror of
https://github.com/rjNemo/vf-site
synced 2026-06-06 01:16:38 +00:00
29 lines
737 B
Python
29 lines
737 B
Python
import json
|
|
from dataclasses import dataclass
|
|
|
|
NAME = "name"
|
|
TEMPLATES = "templates"
|
|
TEMPLATES_DIR = "templatesDir"
|
|
STATIC_FILES_DIR = "staticFilesDir"
|
|
OUT_DIR = "outDir"
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Config:
|
|
name: str
|
|
templates: list[str]
|
|
static_files_dir: list[str]
|
|
out_dir: str
|
|
templates_dir: str
|
|
|
|
|
|
def load() -> Config:
|
|
with open("config.json", "r") as f:
|
|
raw_config = json.loads(f.read())
|
|
return Config(
|
|
name=raw_config[NAME],
|
|
templates=raw_config[TEMPLATES],
|
|
static_files_dir=raw_config[STATIC_FILES_DIR],
|
|
out_dir=raw_config.setdefault(OUT_DIR, "dist"),
|
|
templates_dir=raw_config.setdefault(TEMPLATES_DIR, "templates"),
|
|
)
|