Add development mode with automatic test data seeding

This commit is contained in:
Mondo Diaz
2025-12-11 14:36:22 -06:00
parent cb3d62b02a
commit c08d1082eb
3 changed files with 250 additions and 1 deletions

View File

@@ -3,6 +3,9 @@ from functools import lru_cache
class Settings(BaseSettings):
# Environment
env: str = "development" # "development" or "production"
# Server
server_host: str = "0.0.0.0"
server_port: int = 8080
@@ -28,6 +31,14 @@ class Settings(BaseSettings):
sslmode = f"?sslmode={self.database_sslmode}" if self.database_sslmode else ""
return f"postgresql://{self.database_user}:{self.database_password}@{self.database_host}:{self.database_port}/{self.database_dbname}{sslmode}"
@property
def is_development(self) -> bool:
return self.env.lower() == "development"
@property
def is_production(self) -> bool:
return self.env.lower() == "production"
class Config:
env_prefix = "ORCHARD_"
case_sensitive = False