inital v4
This commit is contained in:
29
v4/server/app/config.py
Normal file
29
v4/server/app/config.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class Config:
|
||||
host: str = os.getenv("NP4_HOST", "0.0.0.0")
|
||||
port: int = int(os.getenv("NP4_PORT", "8080"))
|
||||
api_token: str = os.getenv("NP4_API_TOKEN", "").strip()
|
||||
|
||||
data_dir: Path = Path(os.getenv("NP4_DATA_DIR", "./v4_data")).resolve()
|
||||
ui_dir: Path = Path(
|
||||
os.getenv(
|
||||
"NP4_UI_DIR",
|
||||
str((Path(__file__).resolve().parents[3] / "ui").resolve()),
|
||||
)
|
||||
)
|
||||
pwa_dir: Path = Path(
|
||||
os.getenv(
|
||||
"NP4_PWA_DIR",
|
||||
str((Path(__file__).resolve().parents[3] / "pwa").resolve()),
|
||||
)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def ensure_dirs(cls) -> None:
|
||||
cls.data_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user