This repository has been archived by the owner on Aug 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
app_config.py
92 lines (71 loc) · 2.08 KB
/
app_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
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python
"""
Project-wide application configuration.
DO NOT STORE SECRETS, PASSWORDS, ETC. IN THIS FILE.
They will be exposed to users. Use environment variables instead.
"""
import os
DEPLOYED_NAME = 'fire-forecast'
PROJECT_NAME = 'Fire Forecast'
PROJECT_SLUG = 'fire-forecast'
REPOSITORY_NAME = 'us-wildfires'
PRODUCTION_S3_BUCKETS = ['apps.npr.org', 'apps2.npr.org']
PRODUCTION_SERVERS = ['cron.nprapps.org']
STAGING_S3_BUCKETS = ['stage-apps.npr.org']
STAGING_SERVERS = ['cron-staging.nprapps.org']
S3_BUCKETS = []
SERVERS = []
DEBUG = True
PROJECT_DESCRIPTION = 'An opinionated project template for client-side apps.'
SHARE_URL = 'http://%s/%s/' % (PRODUCTION_S3_BUCKETS[0], PROJECT_SLUG)
COPY_GOOGLE_DOC_KEY = '0AlXMOHKxzQVRdHZuX1UycXplRlBfLVB0UVNldHJYZmc'
TWITTER = {
'TEXT': PROJECT_NAME,
'URL': SHARE_URL
}
FACEBOOK = {
'TITLE': PROJECT_NAME,
'URL': SHARE_URL,
'DESCRIPTION': PROJECT_DESCRIPTION,
'IMAGE_URL': '',
'APP_ID': '138837436154588'
}
NPR_DFP = {
'STORY_ID': '171421875',
'TARGET': '\/news_politics;storyid=171421875'
}
GOOGLE_ANALYTICS_ID = 'UA-5828686-4'
def get_secrets():
"""
A method for accessing our secrets.
"""
secrets = [
'TUMBLR_CONSUMER_KEY',
'TUMBLR_OAUTH_TOKEN',
'TUMBLR_OAUTH_TOKEN_SECRET',
'TUMBLR_APP_SECRET',
'AWS_SECRET_ACCESS_KEY',
'AWS_ACCESS_KEY_ID'
]
secrets_dict = {}
for secret in secrets:
secrets_dict[secret] = os.environ.get(secret, None)
return secrets_dict
def configure_targets(deployment_target):
"""
Configure deployment targets. Abstracted so this can be
overriden for rendering before deployment.
"""
global S3_BUCKETS
global SERVERS
global DEBUG
if deployment_target == 'production':
S3_BUCKETS = PRODUCTION_S3_BUCKETS
SERVERS = PRODUCTION_SERVERS
DEBUG = False
else:
S3_BUCKETS = STAGING_S3_BUCKETS
SERVERS = STAGING_SERVERS
DEBUG = True
DEPLOYMENT_TARGET = os.environ.get('DEPLOYMENT_TARGET', None)
configure_targets(DEPLOYMENT_TARGET)