Commit inicial
This commit is contained in:
commit
5385af660d
10 changed files with 173 additions and 0 deletions
33
app/core/configs.py
Normal file
33
app/core/configs.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue