Implement pydantic .env loader
This commit is contained in:
1
core/scripts/webpanel/config/__init__.py
Normal file
1
core/scripts/webpanel/config/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from .config import CONFIGS
|
||||||
16
core/scripts/webpanel/config/config.py
Normal file
16
core/scripts/webpanel/config/config.py
Normal file
@ -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
|
||||||
Reference in New Issue
Block a user