Establishes foundation for migrating baseball simulation from Discord bot to web application using service-oriented architecture pattern. Key components: - FastAPI application structure with dependency injection - Service layer foundation with base classes and container - Comprehensive directory documentation with README files - PostgreSQL containerization with Docker Compose - Testing structure for unit/integration/e2e tests - Migration planning documentation - Rotating log configuration per user requirements Architecture follows Model/Service/Controller pattern to improve testability, maintainability, and scalability over original monolithic Discord app. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
51 lines
1.6 KiB
Markdown
51 lines
1.6 KiB
Markdown
# Config Directory
|
|
|
|
This directory contains application configuration, constants, and settings management.
|
|
|
|
## Files
|
|
|
|
### `constants.py`
|
|
- **Settings class**: Environment-based configuration using `os.getenv()`
|
|
- **GameConstants**: Migrated constants from Discord app (`../discord-app/constants.py`)
|
|
- **MLB Teams**: Team lookup tables and metadata
|
|
- **Database URLs**: PostgreSQL connection strings for development and testing
|
|
|
|
### `logging_config.py`
|
|
- **Rotating file handlers**: Per user's CLAUDE.md requirements
|
|
- **Console and file output**: Structured logging with proper formatting
|
|
- **Service-specific loggers**: Standardized naming patterns
|
|
|
|
## Key Features
|
|
|
|
### Environment Configuration
|
|
The `Settings` class provides environment-based configuration:
|
|
```python
|
|
from app.config.constants import settings
|
|
|
|
# Database connection
|
|
DATABASE_URL = settings.DATABASE_URL
|
|
|
|
# Discord OAuth
|
|
DISCORD_CLIENT_ID = settings.DISCORD_CLIENT_ID
|
|
```
|
|
|
|
### Migrated Constants
|
|
All game constants are migrated from the actual Discord app source, not assumed values:
|
|
- Season configuration (SBA_SEASON, PD_SEASON)
|
|
- Cardset configurations and rankings
|
|
- Player rarity values
|
|
- MLB team lookup tables
|
|
|
|
### Logging Standards
|
|
Follows rotating log pattern with service-specific naming:
|
|
```python
|
|
logger = logging.getLogger(f'{__name__}.{self.__class__.__name__}')
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
Copy `.env.example` to `.env` and configure:
|
|
- `DATABASE_URL` - PostgreSQL connection string
|
|
- `DISCORD_CLIENT_ID` / `DISCORD_CLIENT_SECRET` - OAuth credentials
|
|
- `DEBUG` - Enable debug mode
|
|
- `SECRET_KEY` - Application secret for sessions |