first commit
This commit is contained in:
38
backend/app/core/config.py
Normal file
38
backend/app/core/config.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from pathlib import Path
|
||||
|
||||
from pydantic import Field
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
app_name: str = 'Mikrotik Backup System'
|
||||
app_env: str = 'development'
|
||||
secret_key: str = 'change-me'
|
||||
jwt_algorithm: str = 'HS256'
|
||||
access_token_expire_minutes: int = 1440
|
||||
database_url: str = 'sqlite:///./storage/routeros_backup_next.db'
|
||||
data_dir: str = './storage'
|
||||
allow_registration: bool = True
|
||||
api_prefix: str = '/api'
|
||||
timezone: str = 'Europe/Warsaw'
|
||||
default_admin_username: str = 'admin'
|
||||
default_admin_password: str = 'admin'
|
||||
smtp_starttls: bool = True
|
||||
smtp_timeout_seconds: int = 20
|
||||
cors_origins: list[str] = Field(default_factory=lambda: ['http://localhost:4200', 'http://127.0.0.1:4200'])
|
||||
|
||||
model_config = SettingsConfigDict(
|
||||
env_file='.env',
|
||||
env_file_encoding='utf-8',
|
||||
extra='ignore',
|
||||
env_nested_delimiter='__',
|
||||
)
|
||||
|
||||
@property
|
||||
def data_path(self) -> Path:
|
||||
path = Path(self.data_dir)
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
return path
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user