feat(issue22/server-flask): Adds extra config for CORS

This commit is contained in:
sovanna 2020-04-14 14:19:30 +09:00
parent a8d02b5962
commit e2bb66f5f1
2 changed files with 6 additions and 1 deletions

View File

@ -23,7 +23,9 @@ def create_app(cfg=config):
CORS(
app,
resources={r'/api/*': {
'origins': '*',
'methods': ['POST', 'OPTIONS'],
'allow_origins': app.config['CORS_ALLOWED_ORIGINS'].split(','),
'allow_headers': app.config['CORS_ALLOWED_HEADERS'].split(','),
}})
return app

View File

@ -16,3 +16,6 @@ MAIL_USERNAME = getenv("FLASK_MAIL_USERNAME")
MAIL_PASSWORD = getenv("FLASK_MAIL_PASSWORD")
MAIL_RECIPIENT = getenv("FLASK_MAIL_RECIPIENT")
CORS_ALLOWED_ORIGINS = getenv("FLASK_CORS_ORIGINS")
CORS_ALLOWED_HEADERS = getenv("FLASK_CORS_ALLOW_HEADERS")