-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
68 lines (54 loc) · 2.29 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
"""Configuration module for the flask application."""
import os
from os.path import dirname, abspath
import tempfile
class Common:
"""Common configuration for all environments."""
API_VERSION = '1'
OPENAPI_VERSION = '3.0.3'
OPENAPI_URL_PREFIX = '/api/v' + API_VERSION
OPENAPI_SWAGGER_UI_PATH = '/documentation'
OPENAPI_SWAGGER_UI_URL = 'https://cdn.jsdelivr.net/npm/swagger-ui-dist/'
# Flask-SqlAlchemy event system is not being used
SQLALCHEMY_TRACK_MODIFICATIONS = False
class Development(Common):
"""Development configuration."""
DATABASE = 'dev_pybook.db'
SQLALCHEMY_DATABASE_URI = ('sqlite:///' + dirname(abspath(__file__)) +
'/' + DATABASE)
SQLALCHEMY_TRACK_MODIFICATIONS = True
USERNAME = 'admin'
PASSWORD = 123
SECRET_KEY = 'key_thats_supposed_to_be_secret'
BCRYPT_LEVEL = 12
DEBUG_TB_INTERCEPT_REDIRECTS = False
TESTING = True
RECAPTCHA_PRIVATE_KEY = ''
CELERY_BROKER_URL='amqp://localhost:5672'
class Testing(Development):
"""Testing configuration."""
DB_FD, DATABASE = tempfile.mkstemp()
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + DATABASE
WTF_CSRF_ENABLED = False
WTF_CSRF_CHECK_DEFAULT = False
SERVER_NAME = 'localhost.localdomain'
class Production(Common):
SESSION_COOKIE_SECURE = True
REMEMBER_COOKIE_SECURE = True
# get values from environment only in production
# otherwise they will not exist
if 'FLASK_ENV' not in os.environ or os.environ['FLASK_ENV'] == 'production':
SECRET_KEY = os.environ['SECRET_KEY']
BCRYPT_LEVEL = os.environ['BCRYPT_LEVEL']
DATABASE = os.environ['DATABASE']
SQLALCHEMY_DATABASE_URI = os.environ['SQLALCHEMY_DATABASE_URI']
USERNAME = os.environ['USERNAME']
PASSWORD = os.environ['PASSWORD']
MAIL_DEFAULT_SENDER = os.environ['MAIL_DEFAULT_SENDER']
SENDGRID_API_KEY = os.environ['SENDGRID_API_KEY']
RECAPTCHA_PRIVATE_KEY = os.environ['RECAPTCHA_PRIVATE_KEY']
SENTRY_DSN = os.environ['SENTRY_DSN']
CLOUDINARY_CLOUD_NAME = os.environ['CLOUDINARY_CLOUD_NAME']
CLOUDINARY_API_KEY = os.environ['CLOUDINARY_API_KEY']
CLOUDINARY_SECRET_KEY = os.environ['CLOUDINARY_SECRET_KEY']
CELERY_BROKER_URL = os.environ['CELERY_BROKER_URL']