-
Notifications
You must be signed in to change notification settings - Fork 342
/
config.py
82 lines (61 loc) · 2.16 KB
/
config.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# pylint: disable=too-few-public-methods,invalid-name,missing-docstring
import os
class BaseConfig(object):
SECRET_KEY = 'this-really-needs-to-be-changed'
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
# POSTGRESQL
# DB_USER = 'user'
# DB_PASSWORD = 'password'
# DB_NAME = 'restplusdb'
# DB_HOST = 'localhost'
# DB_PORT = 5432
# SQLALCHEMY_DATABASE_URI = 'postgresql://{user}:{password}@{host}:{port}/{name}'.format(
# user=DB_USER,
# password=DB_PASSWORD,
# host=DB_HOST,
# port=DB_PORT,
# name=DB_NAME,
# )
# SQLITE
SQLALCHEMY_DATABASE_URI = 'sqlite:///%s' % (os.path.join(PROJECT_ROOT, "example.db"))
DEBUG = False
ERROR_404_HELP = False
REVERSE_PROXY_SETUP = os.getenv('EXAMPLE_API_REVERSE_PROXY_SETUP', False)
AUTHORIZATIONS = {
'oauth2_password': {
'type': 'oauth2',
'flow': 'password',
'scopes': {},
'tokenUrl': '/auth/oauth2/token',
},
# TODO: implement other grant types for third-party apps
#'oauth2_implicit': {
# 'type': 'oauth2',
# 'flow': 'implicit',
# 'scopes': {},
# 'authorizationUrl': '/auth/oauth2/authorize',
#},
}
ENABLED_MODULES = (
'auth',
'users',
'teams',
'api',
)
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
SWAGGER_UI_JSONEDITOR = True
SWAGGER_UI_OAUTH_CLIENT_ID = 'documentation'
SWAGGER_UI_OAUTH_REALM = "Authentication for Flask-RESTplus Example server documentation"
SWAGGER_UI_OAUTH_APP_NAME = "Flask-RESTplus Example server documentation"
# TODO: consider if these are relevant for this project
SQLALCHEMY_TRACK_MODIFICATIONS = True
CSRF_ENABLED = True
class ProductionConfig(BaseConfig):
SECRET_KEY = os.getenv('EXAMPLE_API_SERVER_SECRET_KEY')
SQLALCHEMY_DATABASE_URI = os.getenv('EXAMPLE_API_SERVER_SQLALCHEMY_DATABASE_URI')
class DevelopmentConfig(BaseConfig):
DEBUG = True
class TestingConfig(BaseConfig):
TESTING = True
# Use in-memory SQLite database for testing
SQLALCHEMY_DATABASE_URI = 'sqlite://'