2005 Live Series Updates

This commit is contained in:
Cal Corum 2025-11-08 18:25:08 -06:00
parent db0635b01d
commit a34e553b25
3 changed files with 191 additions and 12 deletions

175
.env Normal file
View File

@ -0,0 +1,175 @@
# Paper Dynasty Database API - Environment Configuration
# Copy this file to .env and update with your actual values
# DO NOT commit .env to version control!
# =============================================================================
# DATABASE CONFIGURATION
# =============================================================================
# Database type: 'sqlite' or 'postgresql'
# Default: sqlite
DATABASE_TYPE=postgresql
# -----------------------------------------------------------------------------
# SQLite Configuration (used when DATABASE_TYPE=sqlite)
# -----------------------------------------------------------------------------
# SQLite uses the file: storage/pd_master.db
# No additional configuration needed for SQLite
# -----------------------------------------------------------------------------
# PostgreSQL Configuration (used when DATABASE_TYPE=postgresql)
# -----------------------------------------------------------------------------
# PostgreSQL host (hostname or IP address)
# Default: localhost
POSTGRES_HOST=sba_postgres
# PostgreSQL port
# Default: 5432
POSTGRES_PORT=5432
# PostgreSQL database name
# Default: pd_master
POSTGRES_DB=paperdynasty_dev
# PostgreSQL username
# Default: pd_admin
POSTGRES_USER=sba_admin
# PostgreSQL password (REQUIRED for PostgreSQL, no default)
POSTGRES_PASSWORD=your_production_password
# =============================================================================
# APPLICATION CONFIGURATION
# =============================================================================
# Logging level: 'INFO' or 'WARN'
# Default: WARN
# Set to INFO for detailed logging during development
LOG_LEVEL=INFO
# API authentication token
# Used for Bearer token authentication on protected endpoints
# Generate a secure random token for production
API_TOKEN=Tp3aO3jhYve5NJF1IqOmJTmk
# Include private endpoints in OpenAPI schema
# Set to any non-empty value to include private endpoints in /docs
# Leave empty or omit to exclude private endpoints
# PRIVATE_IN_SCHEMA=true
# Testing mode
# Set to 'False' to use development database URL (pddev.manticorum.com)
# Leave unset or set to any other value for production
TESTING=TRUE
# =============================================================================
# EXAMPLE CONFIGURATIONS
# =============================================================================
# -----------------------------------------------------------------------------
# Example 1: Local Development with SQLite (Default)
# -----------------------------------------------------------------------------
# DATABASE_TYPE=sqlite
# LOG_LEVEL=INFO
# API_TOKEN=dev_token_12345
# -----------------------------------------------------------------------------
# Example 2: Local Development with PostgreSQL
# -----------------------------------------------------------------------------
# DATABASE_TYPE=postgresql
# POSTGRES_HOST=localhost
# POSTGRES_PORT=5432
# POSTGRES_DB=pd_master_dev
# POSTGRES_USER=pd_admin
# POSTGRES_PASSWORD=dev_password_123
# LOG_LEVEL=INFO
# API_TOKEN=dev_token_12345
# -----------------------------------------------------------------------------
# Example 3: Production with PostgreSQL
# -----------------------------------------------------------------------------
# DATABASE_TYPE=postgresql
# POSTGRES_HOST=db.example.com
# POSTGRES_PORT=5432
# POSTGRES_DB=pd_master_prod
# POSTGRES_USER=pd_prod_user
# POSTGRES_PASSWORD=strong_random_password_here
# LOG_LEVEL=WARN
# API_TOKEN=prod_secure_token_here
# -----------------------------------------------------------------------------
# Example 4: Docker Development with PostgreSQL
# -----------------------------------------------------------------------------
# DATABASE_TYPE=postgresql
# POSTGRES_HOST=postgres # Docker service name
# POSTGRES_PORT=5432
# POSTGRES_DB=pd_master
# POSTGRES_USER=pd_admin
# POSTGRES_PASSWORD=docker_dev_password
# LOG_LEVEL=INFO
# API_TOKEN=docker_dev_token
# =============================================================================
# SECURITY NOTES
# =============================================================================
#
# 1. NEVER commit .env files to version control
# - .env is already in .gitignore
# - Only commit .env.example (this file)
#
# 2. Use strong passwords in production
# - Generate random passwords: openssl rand -base64 32
# - Minimum 20 characters for PostgreSQL password
#
# 3. Rotate API tokens regularly
# - Generate secure tokens: python -c "import secrets; print(secrets.token_urlsafe(32))"
#
# 4. Restrict database access
# - Use firewall rules to limit PostgreSQL access
# - Create separate database users for different environments
# - Grant only necessary privileges
#
# 5. Use environment-specific configurations
# - Development: Relaxed settings, verbose logging
# - Staging: Production-like settings, moderate logging
# - Production: Strict settings, minimal logging
#
# =============================================================================
# MIGRATION NOTES
# =============================================================================
#
# When migrating from SQLite to PostgreSQL:
#
# 1. Keep SQLite running during migration
# - Set DATABASE_TYPE=sqlite
# - Application continues to work normally
#
# 2. Set up PostgreSQL
# - Install PostgreSQL server
# - Create database and user
# - Grant privileges
#
# 3. Test PostgreSQL connection
# - Set DATABASE_TYPE=postgresql
# - Set POSTGRES_* variables
# - Test: python -c "from app.db_engine import db; db.connect(); print('✓ Connected'); db.close()"
#
# 4. Run data migration script
# - Use scripts/migrate_sqlite_to_postgres.py
# - Verify data integrity
# - Compare record counts
#
# 5. Switch to PostgreSQL
# - Update .env: DATABASE_TYPE=postgresql
# - Restart application
# - Monitor logs for errors
#
# 6. Rollback plan (if needed)
# - Update .env: DATABASE_TYPE=sqlite
# - Restart application
# - SQLite backup: storage/pd_master_backup_YYYYMMDD.db
#
# See POSTGRES_MIGRATION_PLAN.md for detailed migration instructions
#
# =============================================================================

View File

@ -35,7 +35,7 @@ WORKDIR /usr/src/app
COPY requirements.txt ./ COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
RUN playwright install RUN playwright install chromium
RUN playwright install-deps RUN playwright install-deps chromium
COPY ./app /app/app COPY ./app /app/app

View File

@ -26,22 +26,22 @@ logging.basicConfig(
level=log_level level=log_level
) )
# 2024, 2018 # 2025, 2005
ranked_cardsets = [24, 25, 26, 20, 21, 22] ranked_cardsets = [24, 25, 26, 27, 28, 29]
LIVE_CARDSET_ID = 24 LIVE_CARDSET_ID = 27
LIVE_PROMO_CARDSET_ID = 25 LIVE_PROMO_CARDSET_ID = 28
CARDSETS = { CARDSETS = {
'ranked': { 'ranked': {
'primary': ranked_cardsets, 'primary': ranked_cardsets,
'human': ranked_cardsets 'human': ranked_cardsets
}, },
'minor-league': { 'minor-league': {
'primary': [24, 8], # 2025, Mario 'primary': [27, 8], # 2005, Mario
'secondary': [17], # 2024 'secondary': [24], # 2025
'human': [x for x in range(1, 30)] 'human': [x for x in range(1, 30)]
}, },
'major-league': { 'major-league': {
'primary': [20, 21, 24, 25, 13, 9, 8], # 1998, 1998 Promos, 2025, 25 Promos, 2018, 2023, Mario 'primary': [27, 28, 24, 25, 13, 14, 6, 8], # 2005 + Promos, 2025 + Promos, 2018 + Promos, 2012, Mario
'secondary': [5, 3], # 2019, 2022 'secondary': [5, 3], # 2019, 2022
'human': ranked_cardsets 'human': ranked_cardsets
}, },
@ -50,9 +50,9 @@ CARDSETS = {
'human': ranked_cardsets 'human': ranked_cardsets
}, },
'flashback': { 'flashback': {
'primary': [5, 1, 3, 9, 8], # 2019, 2021, 2022, 2023, Mario 'primary': [13, 5, 1, 3, 8], # 2018, 2019, 2021, 2022, Mario
'secondary': [13, 5], # 2018, 2019 'secondary': [24], # 2025
'human': [5, 1, 3, 9, 8] # 2019, 2021, 2022, 2023 'human': [13, 5, 1, 3, 8] # 2018, 2019, 2021, 2022
}, },
'gauntlet-3': { 'gauntlet-3': {
'primary': [13], # 2018 'primary': [13], # 2018
@ -83,6 +83,10 @@ CARDSETS = {
'primary': [24], # 2025 'primary': [24], # 2025
'secondary': [17], 'secondary': [17],
'human': [24, 25, 22, 23] 'human': [24, 25, 22, 23]
},
'gauntlet-9': {
'primary': [27], # 2005
'secondary': [24] # 2025
} }
} }