26 lines
580 B
Python
26 lines
580 B
Python
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Configs(BaseSettings):
|
|
"""
|
|
MongoDB configuration settings.
|
|
"""
|
|
HOST: str = ""
|
|
PASSWORD: str = ""
|
|
PORT: int = 0
|
|
DB: int = 0
|
|
|
|
def as_dict(self):
|
|
return dict(
|
|
host=self.HOST,
|
|
password=self.PASSWORD,
|
|
port=int(self.PORT),
|
|
db=self.DB,
|
|
)
|
|
|
|
model_config = SettingsConfigDict(env_prefix="REDIS_")
|
|
|
|
|
|
redis_configs = Configs() # singleton instance of the REDIS configuration settings
|
|
print(redis_configs.as_dict())
|