-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.py
More file actions
43 lines (32 loc) · 1.24 KB
/
config.py
File metadata and controls
43 lines (32 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
if os.environ.get('BARM_SECRET_KEY'):
SECRET_KEY = os.environ['BARM_SECRET_KEY']
else:
raise Exception('The variable BARM_SECRET_KEY is not set')
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
SQLALCHEMY_TRACK_MODIFICATIONS = False
class ProductionConfig(Config):
DEBUG = False
class StagingConfig(Config):
DEVELOPMENT = True
DEBUG = True
class DevelopmentConfig(Config):
DEVELOPMENT = True
DEBUG = True
class TestingConfig(Config):
TESTING = True
def check_oauth_variables(config_class):
if config_class == "ProductionConfig":
if os.environ.get('OAUTHLIB_INSECURE_TRANSPORT'):
raise Exception('The variable OAUTHLIB_INSECURE_TRANSPORT is set')
if os.environ.get('OAUTHLIB_RELAX_TOKEN_SCOPE'):
raise Exception('The variable OAUTHLIB_RELAX_TOKEN_SCOPE is set')
else:
if not os.environ.get('OAUTHLIB_INSECURE_TRANSPORT'):
raise Exception('The variable OAUTHLIB_INSECURE_TRANSPORT is not set')
if not os.environ.get('OAUTHLIB_RELAX_TOKEN_SCOPE'):
raise Exception('The variable OAUTHLIB_RELAX_TOKEN_SCOPE is not set')