mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-02 01:27:24 -04:00
Compare commits
2 Commits
v0.3.0-alp
...
v0.3.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 3502a7ffa8 | |||
| 68d9f241e1 |
@@ -134,15 +134,15 @@ def create_app(
|
||||
from tools.deployment_config import is_dev_mode, get_db_path
|
||||
from api.database import initialize_dev_database, initialize_database
|
||||
|
||||
# Startup
|
||||
# Startup - use closure to access db_path from create_app scope
|
||||
if is_dev_mode():
|
||||
# Initialize dev database (reset unless PRESERVE_DEV_DATA=true)
|
||||
dev_db_path = get_db_path(app.state.db_path)
|
||||
dev_db_path = get_db_path(db_path)
|
||||
initialize_dev_database(dev_db_path)
|
||||
log_dev_mode_startup_warning()
|
||||
else:
|
||||
# Ensure production database schema exists
|
||||
initialize_database(app.state.db_path)
|
||||
initialize_database(db_path)
|
||||
|
||||
yield
|
||||
|
||||
|
||||
@@ -36,9 +36,21 @@ fi
|
||||
|
||||
echo "✅ Environment variables validated"
|
||||
|
||||
# Step 1: Initialize database
|
||||
# Step 1: Initialize database (respecting dev/prod mode)
|
||||
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"
|
||||
|
||||
# Step 2: Merge and validate configuration
|
||||
|
||||
Reference in New Issue
Block a user