Add self-contained configuration and migrations support for modules:
Config auto-discovery (app/modules/config.py):
- Modules can have config.py with Pydantic Settings
- Environment variables prefixed with MODULE_NAME_
- Auto-discovered via get_module_config()
Migrations auto-discovery:
- Each module has migrations/versions/ directory
- Alembic discovers module migrations automatically
- Naming convention: {module}_{seq}_{description}.py
New architecture rules (MOD-013 to MOD-015):
- MOD-013: config.py should export config/config_class
- MOD-014: Migrations must follow naming convention
- MOD-015: Migrations directory must have __init__.py
Created for all 11 self-contained modules:
- config.py placeholder files
- migrations/ directories with __init__.py files
Added core and tenancy module definitions for completeness.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
32 lines
678 B
Python
32 lines
678 B
Python
# app/modules/orders/config.py
|
|
"""
|
|
Module configuration.
|
|
|
|
Environment-based configuration using Pydantic Settings.
|
|
Settings are loaded from environment variables with ORDERS_ prefix.
|
|
|
|
Example:
|
|
ORDERS_SETTING_NAME=value
|
|
|
|
Usage:
|
|
from app.modules.orders.config import config
|
|
value = config.setting_name
|
|
"""
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class ModuleConfig(BaseSettings):
|
|
"""Configuration for orders module."""
|
|
|
|
# Add module-specific settings here
|
|
# Example:
|
|
# api_timeout: int = 30
|
|
# batch_size: int = 100
|
|
|
|
model_config = {"env_prefix": "ORDERS_"}
|
|
|
|
|
|
# Export for auto-discovery
|
|
config_class = ModuleConfig
|
|
config = ModuleConfig()
|