adding base project
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import os
|
||||
from typing import List, Union
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
class Settings(BaseSettings):
|
||||
PROJECT_NAME: str = "AuthSec FastAPI"
|
||||
API_V1_STR: str = "/api"
|
||||
PORT: int = 9119
|
||||
DEBUG: bool = True
|
||||
|
||||
# Security
|
||||
SECRET_KEY: str = "cns-secret-key-change-this-in-production-authsec"
|
||||
ALGORITHM: str = "HS256"
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES: int = 1440 # 24 hours
|
||||
|
||||
# Database
|
||||
DATABASE_URL: str = "sqlite:///./authsec.db"
|
||||
|
||||
# CORS
|
||||
CORS_ORIGINS: str = "http://localhost:4200,http://localhost:3000,http://127.0.0.1:4200,http://localhost:8080,*"
|
||||
|
||||
# Email / SMTP Settings (mirrors Spring Boot JavaMailSender)
|
||||
SMTP_HOST: str = ""
|
||||
SMTP_PORT: int = 587
|
||||
SMTP_USER: str = ""
|
||||
SMTP_PASSWORD: str = ""
|
||||
SMTP_TLS: bool = True
|
||||
EMAILS_FROM_EMAIL: str = "noreply@authsec.com"
|
||||
|
||||
@property
|
||||
def cors_origins_list(self) -> List[str]:
|
||||
if not self.CORS_ORIGINS:
|
||||
return ["*"]
|
||||
return [origin.strip() for origin in self.CORS_ORIGINS.split(",") if origin.strip()]
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
env_file_encoding = "utf-8"
|
||||
case_sensitive = True
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user