-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
57 lines (44 loc) · 1.9 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
import os
basedir = os.path.abspath(os.path.dirname(__file__))
DEFAULT_POSTS_PATH = 'static/assets/posts/'
DEFAULT_PROJECT_FEED_PATH = 'static/assets/projects/project_feed.json'
DEFAULT_POSTS_PER_PAGE = 10
DEFAULT_RECAPTCHA_DATA_ATTRS = {'theme': 'dark'}
DEFAULT_CONTENT_SECURITY_POLICY = {
'default-src': '\'self\' *.spotify.com *.google.com disqus.com *.disqus.com *.disquscdn.com',
'style-src': '\'self\' fonts.googleapis.com',
'font-src': '\'self\' fonts.gstatic.com',
'script-src': '\'self\' *.google-analytics.com *.google.com/recaptcha/api.js *.disqus.com *.disquscdn.com'
}
class Config:
''' Represents the configuration required by the application. '''
# General
DEBUG = False
DEVELOPMENT = False
SECRET_KEY = os.environ['SECRET_KEY']
# Blog
POSTS_PATH = os.environ.get('POSTS_PATH', DEFAULT_POSTS_PATH)
POSTS_PER_PAGE = os.environ.get('POSTS_PER_PAGE', DEFAULT_POSTS_PER_PAGE)
# Project feed
PROJECT_FEED_PATH = os.environ.get('PROJECT_FEED_PATH', DEFAULT_PROJECT_FEED_PATH)
# Email
SENDGRID_API_KEY = os.environ['SENDGRID_API_KEY']
SENDGRID_DEFAULT_FROM = os.environ['SENDGRID_DEFAULT_FROM']
CONTACT_EMAIL = os.environ['CONTACT_EMAIL']
# ReCaptcha
RECAPTCHA_PUBLIC_KEY = os.environ['RECAPTCHA_PUBLIC_KEY']
RECAPTCHA_PRIVATE_KEY = os.environ['RECAPTCHA_PRIVATE_KEY']
RECAPTCHA_DATA_ATTRS = os.environ.get('RECAPTCHA_DATA_ATTRS', DEFAULT_RECAPTCHA_DATA_ATTRS)
# Logging
LOG_LEVEL = os.environ['LOG_LEVEL']
# Monitoring
SENTRY_DSN = os.environ['SENTRY_DSN']
# Security
CONTENT_SECURITY_POLICY = os.environ.get('CONTENT_SECURITY_POLICY', DEFAULT_CONTENT_SECURITY_POLICY)
class ProductionConfig(Config):
''' A configuration for use in production environments. '''
pass
class DevelopmentConfig(Config):
''' A configuration for use in development environments. '''
DEVELOPMENT = True
DEBUG = True