33 lines
No EOL
954 B
Python
33 lines
No EOL
954 B
Python
from pathlib import Path
|
|
|
|
from pydantic import SecretStr
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
# Raiz do projeto (api-podium/), pra achar o .env independente de onde a API for iniciada
|
|
RAIZ_PROJETO = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(
|
|
env_file=RAIZ_PROJETO / '.env',
|
|
env_file_encoding='utf-8',
|
|
env_ignore_empty=True, # variável vazia no .env conta como não configurada
|
|
extra='ignore', # outras variáveis no .env não geram erro
|
|
)
|
|
|
|
# SQL Server
|
|
db_host: str
|
|
db_porta: int = 1433
|
|
db_database: str
|
|
db_login: str
|
|
db_senha: SecretStr # SecretStr evita que a senha apareça em print/log
|
|
db_driver: str = 'ODBC Driver 17 for SQL Server'
|
|
|
|
# Pool de conexões
|
|
db_pool_size: int = 5
|
|
db_pool_max_overflow: int = 10
|
|
|
|
# Configs da api
|
|
port: int
|
|
|
|
settings = Settings() |