Add development mode with automatic test data seeding

- Add ORCHARD_ENV setting (defaults to 'development')
- Add seed.py with test projects, packages, artifacts, and tags
- Automatically seed database on startup in development mode
- Skip seeding if database already contains data
- Skip seeding in production mode (ORCHARD_ENV=production)

Test data includes:
- 4 projects (3 public, 1 private)
- 8 packages across projects
- 5 artifacts with various content types
- 10 tags including version tags and 'latest'
This commit is contained in:
Mondo Diaz
2025-12-11 14:24:34 -06:00
parent cb3d62b02a
commit d4026978bc
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