mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-01 17:17:24 -04:00
fix: respect dev mode in entrypoint database initialization
- Update entrypoint.sh to check DEPLOYMENT_MODE before initializing database - DEV mode: calls initialize_dev_database() which resets the database - PROD mode: calls initialize_database() which preserves existing data - Adds clear logging to show which mode is being used This ensures the dev database is properly reset on container startup, matching the behavior of the lifespan function in api/main.py.
This commit is contained in:
@@ -36,9 +36,21 @@ fi
|
|||||||
|
|
||||||
echo "✅ Environment variables validated"
|
echo "✅ Environment variables validated"
|
||||||
|
|
||||||
# Step 1: Initialize database
|
# Step 1: Initialize database (respecting dev/prod mode)
|
||||||
echo "📊 Initializing database..."
|
echo "📊 Initializing database..."
|
||||||
python -c "from api.database import initialize_database; initialize_database('data/jobs.db')"
|
python -c "
|
||||||
|
from tools.deployment_config import is_dev_mode, get_db_path
|
||||||
|
from api.database import initialize_dev_database, initialize_database
|
||||||
|
|
||||||
|
db_path = 'data/jobs.db'
|
||||||
|
if is_dev_mode():
|
||||||
|
print(' 🔧 DEV mode detected - initializing dev database')
|
||||||
|
dev_db_path = get_db_path(db_path)
|
||||||
|
initialize_dev_database(dev_db_path)
|
||||||
|
else:
|
||||||
|
print(' 🏭 PROD mode - initializing production database')
|
||||||
|
initialize_database(db_path)
|
||||||
|
"
|
||||||
echo "✅ Database initialized"
|
echo "✅ Database initialized"
|
||||||
|
|
||||||
# Step 2: Merge and validate configuration
|
# Step 2: Merge and validate configuration
|
||||||
|
|||||||
Reference in New Issue
Block a user