26 lines
639 B
Python
26 lines
639 B
Python
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = {
|
|
"env_file": ".env",
|
|
"env_file_encoding": "utf-8",
|
|
"case_sensitive": False,
|
|
}
|
|
|
|
database_host: str = "localhost"
|
|
database_port: int = 5432
|
|
database_user: str = "postgres"
|
|
database_password: str = "postgres"
|
|
database_name: str = "weather_data"
|
|
|
|
@property
|
|
def database_url(self) -> str:
|
|
return (
|
|
f"postgresql://{self.database_user}:{self.database_password}"
|
|
f"@{self.database_host}:{self.database_port}/{self.database_name}"
|
|
)
|
|
|
|
|
|
settings = Settings()
|