updated services api
This commit is contained in:
31
ServicesApi/Controllers/Postgres/config.py
Normal file
31
ServicesApi/Controllers/Postgres/config.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Configs(BaseSettings):
|
||||
"""
|
||||
Postgresql configuration settings.
|
||||
"""
|
||||
|
||||
DB: str = ""
|
||||
USER: str = ""
|
||||
PASSWORD: str = ""
|
||||
HOST: str = ""
|
||||
PORT: int = 0
|
||||
ENGINE: str = "postgresql+psycopg2"
|
||||
POOL_PRE_PING: bool = True
|
||||
POOL_SIZE: int = 20
|
||||
MAX_OVERFLOW: int = 10
|
||||
POOL_RECYCLE: int = 600
|
||||
POOL_TIMEOUT: int = 30
|
||||
ECHO: bool = True
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""Generate the database URL."""
|
||||
return f"{self.ENGINE}://{self.USER}:{self.PASSWORD}@{self.HOST}:{self.PORT}/{self.DB}"
|
||||
|
||||
model_config = SettingsConfigDict(env_prefix="POSTGRES_")
|
||||
|
||||
|
||||
# singleton instance of the POSTGRESQL configuration settings
|
||||
postgres_configs = Configs()
|
||||
Reference in New Issue
Block a user