mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-24 13:44:54 +00:00
Generated by Spark: Should handle caprover / cloudflare cors - Check frontend and backend config. example setup: https://frontend.example.com https://backend.example.com
This commit is contained in:
20
backend/.env.production.example
Normal file
20
backend/.env.production.example
Normal file
@@ -0,0 +1,20 @@
|
||||
# Backend Environment Variables (Production)
|
||||
|
||||
# Allowed CORS origins (comma-separated)
|
||||
# Use your actual frontend domain(s)
|
||||
ALLOWED_ORIGINS=https://frontend.example.com,https://www.frontend.example.com
|
||||
|
||||
# Server Port
|
||||
PORT=5001
|
||||
|
||||
# Database path (use /data for persistent CapRover volume)
|
||||
DATABASE_PATH=/data/codeforge.db
|
||||
|
||||
# Debug mode (set to 'false' in production)
|
||||
DEBUG=false
|
||||
|
||||
# Optional: API Key for authentication
|
||||
# API_KEY=your-secure-api-key-here
|
||||
|
||||
# Optional: Rate limiting
|
||||
# RATELIMIT_STORAGE_URL=redis://localhost:6379
|
||||
@@ -7,7 +7,20 @@ from datetime import datetime
|
||||
from contextlib import contextmanager
|
||||
|
||||
app = Flask(__name__)
|
||||
CORS(app)
|
||||
|
||||
# CORS configuration for CapRover/Cloudflare deployment
|
||||
# Allow requests from frontend domain
|
||||
ALLOWED_ORIGINS = os.environ.get('ALLOWED_ORIGINS', '*').split(',')
|
||||
CORS(app,
|
||||
resources={r"/api/*": {
|
||||
"origins": ALLOWED_ORIGINS,
|
||||
"methods": ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
||||
"allow_headers": ["Content-Type", "Authorization", "X-Requested-With"],
|
||||
"expose_headers": ["Content-Type", "X-Total-Count"],
|
||||
"supports_credentials": True,
|
||||
"max_age": 3600
|
||||
}},
|
||||
supports_credentials=True)
|
||||
|
||||
DATABASE_PATH = os.environ.get('DATABASE_PATH', '/data/codeforge.db')
|
||||
os.makedirs(os.path.dirname(DATABASE_PATH), exist_ok=True)
|
||||
|
||||
5
backend/captain-definition
Normal file
5
backend/captain-definition
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"schemaVersion": 2,
|
||||
"dockerfilePath": "./Dockerfile",
|
||||
"dockerfileLines": []
|
||||
}
|
||||
Reference in New Issue
Block a user