From 8dda44664eb6373fc032935769596b5095498994 Mon Sep 17 00:00:00 2001 From: Iam54r1n4 Date: Mon, 3 Feb 2025 19:03:00 +0000 Subject: [PATCH] Implement pydantic .env loader --- core/scripts/webpanel/config/__init__.py | 1 + core/scripts/webpanel/config/config.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 core/scripts/webpanel/config/__init__.py create mode 100644 core/scripts/webpanel/config/config.py diff --git a/core/scripts/webpanel/config/__init__.py b/core/scripts/webpanel/config/__init__.py new file mode 100644 index 0000000..d24f7aa --- /dev/null +++ b/core/scripts/webpanel/config/__init__.py @@ -0,0 +1 @@ +from .config import CONFIGS diff --git a/core/scripts/webpanel/config/config.py b/core/scripts/webpanel/config/config.py new file mode 100644 index 0000000..d7de6a8 --- /dev/null +++ b/core/scripts/webpanel/config/config.py @@ -0,0 +1,16 @@ +from pydantic_settings import BaseSettings + + +class Configs(BaseSettings): + ADMIN_USERNAME: str + ADMIN_PASSWORD: str + API_TOKEN: str + EXPIRATION_MINUTES: int + DEBUG: bool + + class Config: + env_file = '.env' + env_file_encoding = 'utf-8' + + +CONFIGS = Configs() # type: ignore