forked from webcompat/webcompat.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py.example
118 lines (102 loc) · 4.15 KB
/
config.py.example
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
# Define the application directory
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
THREADS_PER_PAGE = 8
# ~3 months-ish expires for static junk
SEND_FILE_MAX_AGE_DEFAULT = 9000000
# Secret key for signing cookies.
# Doesn't really matter for local testing.
SECRET_KEY = "meow"
# the PRODUCTION and DEVELOPMENT env var is set in uwsgi.conf
PRODUCTION = os.environ.get('PRODUCTION')
DEVELOPMENT = os.environ.get('DEVELOPMENT')
# Are we serving the app from localhost?
LOCALHOST = not PRODUCTION and not DEVELOPMENT
# Cache settings
if PRODUCTION:
CACHE_TYPE = 'filesystem'
CACHE_DIR = '/tmp/cache/webcompat'
else:
CACHE_TYPE = 'filesystem'
CACHE_DIR = '/tmp/cache/staging.webcompat'
# Flask Limiter settings
# See http://flask-limiter.readthedocs.org/en/latest/#configuration
RATELIMIT_STORAGE_URL = 'memory://'
RATELIMIT_STRATEGY = 'moving-window'
# Image uploading settings
# See http://pythonhosted.org/Flask-Uploads/#configuration
if PRODUCTION:
UPLOADS_DEFAULT_DEST = ''
UPLOADS_DEFAULT_URL = ''
elif DEVELOPMENT:
UPLOADS_DEFAULT_DEST = ''
UPLOADS_DEFAULT_URL = ''
elif LOCALHOST:
UPLOADS_DEFAULT_DEST = BASE_DIR
UPLOADS_DEFAULT_URL = 'http://localhost:5000/'
DEBUG = False
if not PRODUCTION:
DEBUG = True
# Logging Capabilities
# To benefit from the logging, you may want to add:
# app.logger.info(Thing_To_Log)
# it will create a line with the following format
# 2015-09-14 20:50:19,185 INFO: Thing_To_Log [in /codepath/views.py:127]
LOG_FILE = '/tmp/webcompat.log'
LOG_FMT = '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'
# Get the client id and client secret from GitHub if you're part of the webcompat
# organization. Otherwise, create your own test and production applications,
# and take note of the client id and client secret GitHub gives you.
#
# [1]<https://github.com/organizations/webcompat/settings/applications/>
# If you're running this locally, you can ignore PRODUCTION and DEVELOPMENT
# blocks
# Production = webcompat.com
if PRODUCTION:
GITHUB_CLIENT_ID = ""
GITHUB_CLIENT_SECRET = ""
GITHUB_CALLBACK_URL = ""
# Development = staging.webcompat.com
elif DEVELOPMENT:
GITHUB_CLIENT_ID = ""
GITHUB_CLIENT_SECRET = ""
GITHUB_CALLBACK_URL = ""
else:
# We're running on localhost, use the test application
GITHUB_CLIENT_ID = os.environ.get('FAKE_ID') or ""
GITHUB_CLIENT_SECRET = os.environ.get('FAKE_SECRET') or ""
GITHUB_CALLBACK_URL = "http://localhost:5000/callback"
# GiHub Issues repo URI
if PRODUCTION:
ISSUES_REPO_URI = "<user>/<repo>/issues"
else:
# Development and Local instances use the same test repo
# Expects a string like "<user>/<repo>/issues", e.g.,
# ISSUES_REPO_URI = os.environ.get('ISSUES_REPO_URI') or "miketaylr/test-repo/issues"
ISSUES_REPO_URI = os.environ.get('ISSUES_REPO_URI') or ""
# This is the oauth token we use to report issues on behalf of people
# who don't want to give GitHub oauth access (or don't have GitHub accounts)
# If you don't want to create another user for testing, you could put in
# your own access token. See
# help.github.com/articles/creating-an-access-token-for-command-line-use
OAUTH_TOKEN = os.environ.get('OAUTH_TOKEN') or ""
# Status categories used in the project
# 'new', 'needsdiagnosis', 'needscontact', 'contactready' , 'sitewait', 'close'
# Creating the model
Category = namedtuple('Category', ['name', 'dataAttribute', 'label'])
CATEGORIES = []
cat_labels = [('new', 'new', 'New Issues'),
('needsDiagnosis', 'needsdiagnosis', 'Needs Diagnosis'),
('needsContact', 'needscontact', 'Needs Contact'),
('sitewait', 'sitewait', 'Site Contacted'),
('close', 'closed', 'Closed')]
# populating the categories for issues status
for cat_label in cat_labels:
CATEGORIES.append(Category(name=cat_label[0],
dataAttribute=cat_label[1],
label=cat_label[2]))