mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 12:48:25 +00:00
Allows CORS connections from frontend
This commit is contained in:
parent
820bc23841
commit
73ce70b574
@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import re
|
||||||
from os import environ
|
from os import environ
|
||||||
|
|
||||||
basedir = os.path.abspath(os.path.dirname(__file__))
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
@ -6,7 +7,7 @@ basedir = os.path.abspath(os.path.dirname(__file__))
|
|||||||
JSON_SORT_KEYS = False # CRITICAL. Do not sort the data when returning values to the front end.
|
JSON_SORT_KEYS = False # CRITICAL. Do not sort the data when returning values to the front end.
|
||||||
|
|
||||||
NAME = "CR Connect Workflow"
|
NAME = "CR Connect Workflow"
|
||||||
CORS_ENABLED = False
|
CORS_ALLOW_ORIGINS = re.split(r',\s*', environ.get('CORS_ALLOW_ORIGINS', default="localhost:4200, localhost:5002"))
|
||||||
DEVELOPMENT = environ.get('DEVELOPMENT', default="true") == "true"
|
DEVELOPMENT = environ.get('DEVELOPMENT', default="true") == "true"
|
||||||
TESTING = environ.get('TESTING', default="false") == "true"
|
TESTING = environ.get('TESTING', default="false") == "true"
|
||||||
PRODUCTION = (environ.get('PRODUCTION', default="false") == "true") or (not DEVELOPMENT and not TESTING)
|
PRODUCTION = (environ.get('PRODUCTION', default="false") == "true") or (not DEVELOPMENT and not TESTING)
|
||||||
@ -48,8 +49,10 @@ LDAP_URL = environ.get('LDAP_URL', default="ldap.virginia.edu")
|
|||||||
LDAP_TIMEOUT_SEC = environ.get('LDAP_TIMEOUT_SEC', default=3)
|
LDAP_TIMEOUT_SEC = environ.get('LDAP_TIMEOUT_SEC', default=3)
|
||||||
print('=== USING DEFAULT CONFIG: ===')
|
print('=== USING DEFAULT CONFIG: ===')
|
||||||
print('DB_HOST = ', DB_HOST)
|
print('DB_HOST = ', DB_HOST)
|
||||||
|
print('CORS_ALLOW_ORIGINS = ', CORS_ALLOW_ORIGINS)
|
||||||
print('DEVELOPMENT = ', DEVELOPMENT)
|
print('DEVELOPMENT = ', DEVELOPMENT)
|
||||||
print('TESTING = ', TESTING)
|
print('TESTING = ', TESTING)
|
||||||
print('PRODUCTION = ', PRODUCTION)
|
print('PRODUCTION = ', PRODUCTION)
|
||||||
print('PB_BASE_URL = ', PB_BASE_URL)
|
print('PB_BASE_URL = ', PB_BASE_URL)
|
||||||
print('LDAP_URL = ', LDAP_URL)
|
print('LDAP_URL = ', LDAP_URL)
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ import os
|
|||||||
basedir = os.path.abspath(os.path.dirname(__file__))
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
NAME = "CR Connect Workflow"
|
NAME = "CR Connect Workflow"
|
||||||
CORS_ENABLED = False
|
|
||||||
DEVELOPMENT = True
|
DEVELOPMENT = True
|
||||||
TESTING = True
|
TESTING = True
|
||||||
SQLALCHEMY_DATABASE_URI = "postgresql://crc_user:crc_pass@localhost:5432/crc_test"
|
SQLALCHEMY_DATABASE_URI = "postgresql://crc_user:crc_pass@localhost:5432/crc_test"
|
||||||
|
@ -2,7 +2,6 @@ import os
|
|||||||
basedir = os.path.abspath(os.path.dirname(__file__))
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
NAME = "CR Connect Workflow"
|
NAME = "CR Connect Workflow"
|
||||||
CORS_ENABLED = False
|
|
||||||
DEVELOPMENT = True
|
DEVELOPMENT = True
|
||||||
TESTING = True
|
TESTING = True
|
||||||
SQLALCHEMY_DATABASE_URI = "postgresql://postgres:@localhost:5432/crc_test"
|
SQLALCHEMY_DATABASE_URI = "postgresql://postgres:@localhost:5432/crc_test"
|
||||||
|
@ -36,7 +36,7 @@ from crc import models
|
|||||||
from crc import api
|
from crc import api
|
||||||
|
|
||||||
connexion_app.add_api('api.yml')
|
connexion_app.add_api('api.yml')
|
||||||
cors = CORS(connexion_app.app)
|
cors = CORS(connexion_app.app, resources={r"/v1.0/*": {"origins": app.config['CORS_ALLOW_ORIGINS']}})
|
||||||
|
|
||||||
|
|
||||||
@app.cli.command()
|
@app.cli.command()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user