summaryrefslogtreecommitdiffstats
path: root/core/config.py
blob: b9f6878b725619a8f8ea127231fc07c029cb7dfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import pydantic


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__