forked from M-Labs/web2019
feat(issue22/server-flask): Adds extra config for CORS
This commit is contained in:
parent
a8d02b5962
commit
e2bb66f5f1
|
@ -23,7 +23,9 @@ def create_app(cfg=config):
|
||||||
CORS(
|
CORS(
|
||||||
app,
|
app,
|
||||||
resources={r'/api/*': {
|
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
|
return app
|
||||||
|
|
|
@ -16,3 +16,6 @@ MAIL_USERNAME = getenv("FLASK_MAIL_USERNAME")
|
||||||
MAIL_PASSWORD = getenv("FLASK_MAIL_PASSWORD")
|
MAIL_PASSWORD = getenv("FLASK_MAIL_PASSWORD")
|
||||||
|
|
||||||
MAIL_RECIPIENT = getenv("FLASK_MAIL_RECIPIENT")
|
MAIL_RECIPIENT = getenv("FLASK_MAIL_RECIPIENT")
|
||||||
|
|
||||||
|
CORS_ALLOWED_ORIGINS = getenv("FLASK_CORS_ORIGINS")
|
||||||
|
CORS_ALLOWED_HEADERS = getenv("FLASK_CORS_ALLOW_HEADERS")
|
||||||
|
|
Loading…
Reference in New Issue