2019-12-18 19:02:17 +00:00
|
|
|
import os
|
2020-05-12 14:43:52 +00:00
|
|
|
import re
|
2020-04-15 15:49:45 +00:00
|
|
|
from os import environ
|
2020-02-20 20:35:07 +00:00
|
|
|
|
2019-12-18 19:02:17 +00:00
|
|
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
2020-05-06 14:59:49 +00:00
|
|
|
JSON_SORT_KEYS = False # CRITICAL. Do not sort the data when returning values to the front end.
|
|
|
|
|
2020-12-09 17:13:17 +00:00
|
|
|
# The API_TOKEN is used to ensure that the
|
|
|
|
# workflow synch can work without a lot of
|
|
|
|
# back and forth.
|
|
|
|
# you may want to change this to something simple for testing!!
|
|
|
|
# NB, if you change this in the local endpoint,
|
|
|
|
# it needs to be changed in the remote endpoint as well
|
2020-12-10 15:06:21 +00:00
|
|
|
API_TOKEN = environ.get('API_TOKEN', default = 'af95596f327c9ecc007b60414fc84b61')
|
2020-12-09 17:13:17 +00:00
|
|
|
|
2019-11-21 16:36:32 +00:00
|
|
|
NAME = "CR Connect Workflow"
|
2021-01-26 14:35:35 +00:00
|
|
|
DEFAULT_PORT = "5000"
|
|
|
|
FLASK_PORT = environ.get('PORT0') or environ.get('FLASK_PORT', default=DEFAULT_PORT)
|
2021-05-20 17:10:04 +00:00
|
|
|
FRONTEND = environ.get('FRONTEND', default="localhost:4200")
|
|
|
|
BPMN = environ.get('BPMN', default="localhost:5002")
|
2021-05-06 19:31:33 +00:00
|
|
|
CORS_DEFAULT = f'{FRONTEND}, {BPMN}'
|
|
|
|
CORS_ALLOW_ORIGINS = re.split(r',\s*', environ.get('CORS_ALLOW_ORIGINS', default=CORS_DEFAULT))
|
2020-04-15 20:49:03 +00:00
|
|
|
TESTING = environ.get('TESTING', default="false") == "true"
|
2020-05-31 20:49:39 +00:00
|
|
|
PRODUCTION = (environ.get('PRODUCTION', default="false") == "true")
|
|
|
|
TEST_UID = environ.get('TEST_UID', default="dhf8r")
|
2020-06-17 12:54:43 +00:00
|
|
|
ADMIN_UIDS = re.split(r',\s*', environ.get('ADMIN_UIDS', default="dhf8r,ajl2j,cah3us,cl3wf"))
|
2020-04-15 15:49:45 +00:00
|
|
|
|
2020-06-02 01:59:55 +00:00
|
|
|
# Sentry flag
|
2020-07-19 22:40:33 +00:00
|
|
|
ENABLE_SENTRY = environ.get('ENABLE_SENTRY', default="false") == "true" # To be removed soon
|
|
|
|
SENTRY_ENVIRONMENT = environ.get('SENTRY_ENVIRONMENT', None)
|
2020-06-02 01:59:55 +00:00
|
|
|
|
2020-05-24 02:07:22 +00:00
|
|
|
# Add trailing slash to base path
|
2020-05-24 04:05:13 +00:00
|
|
|
APPLICATION_ROOT = re.sub(r'//', '/', '/%s/' % environ.get('APPLICATION_ROOT', default="/").strip('/'))
|
2020-05-24 02:07:22 +00:00
|
|
|
|
2020-04-15 15:49:45 +00:00
|
|
|
DB_HOST = environ.get('DB_HOST', default="localhost")
|
|
|
|
DB_PORT = environ.get('DB_PORT', default="5432")
|
|
|
|
DB_NAME = environ.get('DB_NAME', default="crc_dev")
|
|
|
|
DB_USER = environ.get('DB_USER', default="crc_user")
|
|
|
|
DB_PASSWORD = environ.get('DB_PASSWORD', default="crc_pass")
|
2020-11-23 21:20:10 +00:00
|
|
|
SQLALCHEMY_ENGINE_OPTIONS = {
|
|
|
|
"pool_pre_ping": True,
|
|
|
|
"pool_recycle": 300,
|
|
|
|
}
|
2020-11-23 20:33:51 +00:00
|
|
|
SQLALCHEMY_POOL_SIZE = 10
|
|
|
|
SQLALCHEMY_MAX_OVERFLOW = 20
|
2020-11-19 16:25:58 +00:00
|
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
2020-04-15 17:25:12 +00:00
|
|
|
SQLALCHEMY_DATABASE_URI = environ.get(
|
|
|
|
'SQLALCHEMY_DATABASE_URI',
|
|
|
|
default="postgresql://%s:%s@%s:%s/%s" % (DB_USER, DB_PASSWORD, DB_HOST, DB_PORT, DB_NAME)
|
|
|
|
)
|
2020-11-19 16:25:58 +00:00
|
|
|
|
|
|
|
|
2020-06-11 15:29:58 +00:00
|
|
|
TOKEN_AUTH_TTL_HOURS = float(environ.get('TOKEN_AUTH_TTL_HOURS', default=24))
|
2020-07-10 15:26:15 +00:00
|
|
|
SECRET_KEY = environ.get('SECRET_KEY', default="Shhhh!!! This is secret! And better darn well not show up in prod.")
|
2020-04-15 15:49:45 +00:00
|
|
|
SWAGGER_AUTH_KEY = environ.get('SWAGGER_AUTH_KEY', default="SWAGGER")
|
2020-02-20 18:30:48 +00:00
|
|
|
# %s/%i placeholders expected for uva_id and study_id in various calls.
|
2020-05-27 12:35:04 +00:00
|
|
|
PB_ENABLED = environ.get('PB_ENABLED', default="false") == "true"
|
2020-06-13 15:56:00 +00:00
|
|
|
PB_BASE_URL = environ.get('PB_BASE_URL', default="http://localhost:5001/v2.0/").strip('/') + '/' # Trailing slash required
|
2020-04-15 15:49:45 +00:00
|
|
|
PB_USER_STUDIES_URL = environ.get('PB_USER_STUDIES_URL', default=PB_BASE_URL + "user_studies?uva_id=%s")
|
|
|
|
PB_INVESTIGATORS_URL = environ.get('PB_INVESTIGATORS_URL', default=PB_BASE_URL + "investigators?studyid=%i")
|
|
|
|
PB_REQUIRED_DOCS_URL = environ.get('PB_REQUIRED_DOCS_URL', default=PB_BASE_URL + "required_docs?studyid=%i")
|
|
|
|
PB_STUDY_DETAILS_URL = environ.get('PB_STUDY_DETAILS_URL', default=PB_BASE_URL + "study?studyid=%i")
|
2020-11-05 15:45:51 +00:00
|
|
|
PB_SPONSORS_URL = environ.get('PB_SPONSORS_URL', default=PB_BASE_URL + "sponsors?studyid=%i")
|
2021-05-01 19:20:47 +00:00
|
|
|
PB_IRB_INFO_URL = environ.get('PB_IRB_INFO_URL', default=PB_BASE_URL + "current_irb_info/%i")
|
2021-02-11 16:17:21 +00:00
|
|
|
|
|
|
|
# Ldap Configuration
|
2020-05-24 02:07:22 +00:00
|
|
|
LDAP_URL = environ.get('LDAP_URL', default="ldap.virginia.edu").strip('/') # No trailing slash or http://
|
2020-06-05 21:49:55 +00:00
|
|
|
LDAP_TIMEOUT_SEC = int(environ.get('LDAP_TIMEOUT_SEC', default=1))
|
2021-02-11 16:17:21 +00:00
|
|
|
LDAP_USER = environ.get('LDAP_USER', default='')
|
|
|
|
LDAP_PASS = environ.get('LDAP_PASS', default='')
|
2020-05-27 02:42:49 +00:00
|
|
|
|
2020-08-14 17:04:22 +00:00
|
|
|
# Github settings
|
2020-07-17 18:10:55 +00:00
|
|
|
GITHUB_TOKEN = environ.get('GITHUB_TOKEN', None)
|
2020-08-14 17:04:22 +00:00
|
|
|
GITHUB_REPO = environ.get('GITHUB_REPO', None)
|
|
|
|
TARGET_BRANCH = environ.get('TARGET_BRANCH', None)
|
2020-07-17 15:49:47 +00:00
|
|
|
|
2020-06-05 19:54:37 +00:00
|
|
|
# Email configuration
|
2020-06-17 14:53:02 +00:00
|
|
|
DEFAULT_SENDER = 'askresearch@virginia.edu'
|
2020-06-05 02:37:28 +00:00
|
|
|
FALLBACK_EMAILS = ['askresearch@virginia.edu', 'sartographysupport@googlegroups.com']
|
2020-06-08 18:15:56 +00:00
|
|
|
MAIL_DEBUG = environ.get('MAIL_DEBUG', default=True)
|
|
|
|
MAIL_SERVER = environ.get('MAIL_SERVER', default='smtp.mailtrap.io')
|
|
|
|
MAIL_PORT = environ.get('MAIL_PORT', default=2525)
|
|
|
|
MAIL_USE_SSL = environ.get('MAIL_USE_SSL', default=False)
|
2020-06-08 18:46:36 +00:00
|
|
|
MAIL_USE_TLS = environ.get('MAIL_USE_TLS', default=False)
|
2020-06-08 18:15:56 +00:00
|
|
|
MAIL_USERNAME = environ.get('MAIL_USERNAME', default='')
|
|
|
|
MAIL_PASSWORD = environ.get('MAIL_PASSWORD', default='')
|