From 143a4a6e8c70557710d1b207a176f169d145ed1e Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 12 Nov 2022 22:10:06 -0700 Subject: Start some settings work --- core/config.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'core/config.py') diff --git a/core/config.py b/core/config.py index 0f09404..b9f6878 100644 --- a/core/config.py +++ b/core/config.py @@ -1,3 +1,20 @@ -class Config: +import pydantic - pass + +class Config(pydantic.BaseModel): + + # Basic configuration options + site_name: str = "takahē" + identity_max_age: int = 24 * 60 * 60 + + # Cached ORM object storage + __singleton__ = None + + class Config: + env_prefix = "takahe_" + + @classmethod + def load(cls) -> "Config": + if cls.__singleton__ is None: + cls.__singleton__ = cls() + return cls.__singleton__ -- cgit v1.2.3