2015-11-01 17:10:52 +01:00
|
|
|
from __future__ import absolute_import
|
2013-12-11 17:08:21 +01:00
|
|
|
# Django settings for zulip project.
|
2014-10-28 16:54:54 +01:00
|
|
|
########################################################################
|
|
|
|
# Here's how settings for the Zulip project work:
|
2013-09-24 20:28:28 +02:00
|
|
|
#
|
2014-10-28 16:54:54 +01:00
|
|
|
# * settings.py contains non-site-specific and settings configuration
|
|
|
|
# for the Zulip Django app.
|
2016-07-20 05:42:43 +02:00
|
|
|
# * settings.py imports prod_settings.py, and any site-specific configuration
|
2016-07-20 05:45:50 +02:00
|
|
|
# belongs there. The template for prod_settings.py is prod_settings_template.py
|
2016-06-16 08:44:01 +02:00
|
|
|
#
|
|
|
|
# See http://zulip.readthedocs.io/en/latest/settings.html for more information
|
|
|
|
#
|
2014-10-28 16:54:54 +01:00
|
|
|
########################################################################
|
2017-06-04 03:33:32 +02:00
|
|
|
from copy import deepcopy
|
2012-08-28 18:45:32 +02:00
|
|
|
import os
|
2012-09-17 23:30:29 +02:00
|
|
|
import platform
|
2013-03-26 22:08:25 +01:00
|
|
|
import time
|
2013-09-26 23:06:01 +02:00
|
|
|
import sys
|
2015-11-01 17:14:36 +01:00
|
|
|
import six.moves.configparser
|
2012-08-28 18:44:51 +02:00
|
|
|
|
2014-01-07 22:20:29 +01:00
|
|
|
from zerver.lib.db import TimeTrackingConnection
|
2017-01-18 12:52:01 +01:00
|
|
|
import zerver.lib.logging_util
|
2016-03-11 10:57:29 +01:00
|
|
|
import six
|
2013-02-20 22:26:06 +01:00
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
########################################################################
|
|
|
|
# INITIAL SETTINGS
|
|
|
|
########################################################################
|
|
|
|
|
2016-07-12 19:22:33 +02:00
|
|
|
DEPLOY_ROOT = os.path.join(os.path.realpath(os.path.dirname(__file__)), '..')
|
|
|
|
|
2015-11-01 17:14:36 +01:00
|
|
|
config_file = six.moves.configparser.RawConfigParser()
|
2013-11-01 00:00:30 +01:00
|
|
|
config_file.read("/etc/zulip/zulip.conf")
|
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
# Whether this instance of Zulip is running in a production environment.
|
2015-08-21 09:18:44 +02:00
|
|
|
PRODUCTION = config_file.has_option('machine', 'deploy_type')
|
|
|
|
DEVELOPMENT = not PRODUCTION
|
2015-08-21 09:02:03 +02:00
|
|
|
|
2015-11-01 17:14:36 +01:00
|
|
|
secrets_file = six.moves.configparser.RawConfigParser()
|
2015-08-21 09:18:44 +02:00
|
|
|
if PRODUCTION:
|
2015-08-21 07:12:15 +02:00
|
|
|
secrets_file.read("/etc/zulip/zulip-secrets.conf")
|
|
|
|
else:
|
2016-07-12 19:22:33 +02:00
|
|
|
secrets_file.read(os.path.join(DEPLOY_ROOT, "zproject/dev-secrets.conf"))
|
2015-08-21 07:12:15 +02:00
|
|
|
|
|
|
|
def get_secret(key):
|
2017-08-14 06:11:51 +02:00
|
|
|
# type: (str) -> None
|
2015-08-21 07:12:15 +02:00
|
|
|
if secrets_file.has_option('secrets', key):
|
|
|
|
return secrets_file.get('secrets', key)
|
|
|
|
return None
|
|
|
|
|
2015-08-19 01:26:51 +02:00
|
|
|
# Make this unique, and don't share it with anybody.
|
|
|
|
SECRET_KEY = get_secret("secret_key")
|
|
|
|
|
|
|
|
# A shared secret, used to authenticate different parts of the app to each other.
|
|
|
|
SHARED_SECRET = get_secret("shared_secret")
|
|
|
|
|
|
|
|
# We use this salt to hash a user's email into a filename for their user-uploaded
|
|
|
|
# avatar. If this salt is discovered, attackers will only be able to determine
|
|
|
|
# that the owner of an email account has uploaded an avatar to Zulip, which isn't
|
|
|
|
# the end of the world. Don't use the salt where there is more security exposure.
|
|
|
|
AVATAR_SALT = get_secret("avatar_salt")
|
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
# SERVER_GENERATION is used to track whether the server has been
|
|
|
|
# restarted for triggering browser clients to reload.
|
2013-09-24 20:28:28 +02:00
|
|
|
SERVER_GENERATION = int(time.time())
|
2012-09-17 23:30:29 +02:00
|
|
|
|
2016-10-28 00:04:05 +02:00
|
|
|
# Key to authenticate this server to zulip.org for push notifications, etc.
|
|
|
|
ZULIP_ORG_KEY = get_secret("zulip_org_key")
|
|
|
|
ZULIP_ORG_ID = get_secret("zulip_org_id")
|
|
|
|
|
2016-05-10 01:55:43 +02:00
|
|
|
if 'DEBUG' not in globals():
|
2017-06-10 20:28:48 +02:00
|
|
|
# Uncomment end of next line to test CSS minification.
|
|
|
|
# For webpack JS minification use tools/run_dev.py --minify
|
2017-07-09 01:45:19 +02:00
|
|
|
DEBUG = DEVELOPMENT # and platform.node() != 'your-machine'
|
2013-11-12 20:37:23 +01:00
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
if DEBUG:
|
|
|
|
INTERNAL_IPS = ('127.0.0.1',)
|
2012-08-28 18:44:51 +02:00
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
# Detect whether we're running as a queue worker; this impacts the logging configuration.
|
2014-01-07 22:27:52 +01:00
|
|
|
if len(sys.argv) > 2 and sys.argv[0].endswith('manage.py') and sys.argv[1] == 'process_queue':
|
|
|
|
IS_WORKER = True
|
|
|
|
else:
|
|
|
|
IS_WORKER = False
|
|
|
|
|
2012-09-19 22:25:13 +02:00
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
# This is overridden in test_settings.py for the test suites
|
|
|
|
TEST_SUITE = False
|
|
|
|
# The new user tutorial is enabled by default, but disabled for client tests.
|
|
|
|
TUTORIAL_ENABLED = True
|
2016-12-15 07:02:42 +01:00
|
|
|
# This is overridden in test_settings.py for the test suites
|
|
|
|
CASPER_TESTS = False
|
2012-09-14 22:29:53 +02:00
|
|
|
|
2016-07-20 05:42:43 +02:00
|
|
|
# Import variables like secrets from the prod_settings file
|
|
|
|
# Import prod_settings after determining the deployment/machine type
|
2015-08-21 09:18:44 +02:00
|
|
|
if PRODUCTION:
|
2016-07-20 05:42:43 +02:00
|
|
|
from .prod_settings import *
|
2015-08-21 08:19:57 +02:00
|
|
|
else:
|
2016-06-17 02:30:48 +02:00
|
|
|
from .dev_settings import *
|
2015-08-21 08:19:57 +02:00
|
|
|
|
2015-08-22 22:31:19 +02:00
|
|
|
########################################################################
|
|
|
|
# DEFAULT VALUES FOR SETTINGS
|
|
|
|
########################################################################
|
|
|
|
|
2016-07-20 05:42:43 +02:00
|
|
|
# For any settings that are not defined in prod_settings.py,
|
2015-08-22 22:31:19 +02:00
|
|
|
# we want to initialize them to sane default
|
|
|
|
DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
|
|
|
|
'TWITTER_CONSUMER_SECRET': '',
|
|
|
|
'TWITTER_ACCESS_TOKEN_KEY': '',
|
|
|
|
'TWITTER_ACCESS_TOKEN_SECRET': '',
|
|
|
|
'EMAIL_GATEWAY_PATTERN': '',
|
|
|
|
'EMAIL_GATEWAY_EXAMPLE': '',
|
|
|
|
'EMAIL_GATEWAY_BOT': None,
|
|
|
|
'EMAIL_GATEWAY_LOGIN': None,
|
|
|
|
'EMAIL_GATEWAY_PASSWORD': None,
|
|
|
|
'EMAIL_GATEWAY_IMAP_SERVER': None,
|
|
|
|
'EMAIL_GATEWAY_IMAP_PORT': None,
|
|
|
|
'EMAIL_GATEWAY_IMAP_FOLDER': None,
|
2016-07-19 07:04:14 +02:00
|
|
|
'EMAIL_GATEWAY_EXTRA_PATTERN_HACK': None,
|
2017-02-16 01:49:27 +01:00
|
|
|
'EMAIL_HOST': None,
|
2017-02-22 06:15:27 +01:00
|
|
|
'EMAIL_BACKEND': None,
|
2017-08-16 01:51:05 +02:00
|
|
|
'NOREPLY_EMAIL_ADDRESS': "noreply@" + EXTERNAL_HOST.split(":")[0],
|
2015-08-22 22:31:19 +02:00
|
|
|
'S3_KEY': '',
|
|
|
|
'S3_SECRET_KEY': '',
|
|
|
|
'S3_AVATAR_BUCKET': '',
|
|
|
|
'LOCAL_UPLOADS_DIR': None,
|
2017-03-06 06:41:38 +01:00
|
|
|
'DATA_UPLOAD_MAX_MEMORY_SIZE': 25 * 1024 * 1024,
|
2015-11-21 04:08:53 +01:00
|
|
|
'MAX_FILE_UPLOAD_SIZE': 25,
|
2017-03-06 06:22:28 +01:00
|
|
|
'MAX_AVATAR_FILE_SIZE': 5,
|
|
|
|
'MAX_ICON_FILE_SIZE': 5,
|
2017-03-13 05:45:50 +01:00
|
|
|
'MAX_EMOJI_FILE_SIZE': 5,
|
2015-08-22 22:31:19 +02:00
|
|
|
'ERROR_REPORTING': True,
|
2017-01-24 07:54:18 +01:00
|
|
|
'BROWSER_ERROR_REPORTING': False,
|
2016-07-19 06:41:55 +02:00
|
|
|
'STAGING_ERROR_NOTIFICATIONS': False,
|
2016-08-12 20:09:38 +02:00
|
|
|
'EVENT_LOGS_ENABLED': False,
|
2016-07-19 06:44:48 +02:00
|
|
|
'SAVE_FRONTEND_STACKTRACES': False,
|
2015-09-20 09:25:27 +02:00
|
|
|
'JWT_AUTH_KEYS': {},
|
2015-08-22 22:31:19 +02:00
|
|
|
'NAME_CHANGES_DISABLED': False,
|
|
|
|
'DEPLOYMENT_ROLE_NAME': "",
|
2016-01-21 12:52:24 +01:00
|
|
|
'RABBITMQ_HOST': 'localhost',
|
|
|
|
'RABBITMQ_USERNAME': 'zulip',
|
|
|
|
'MEMCACHED_LOCATION': '127.0.0.1:11211',
|
|
|
|
'RATE_LIMITING': True,
|
|
|
|
'REDIS_HOST': '127.0.0.1',
|
|
|
|
'REDIS_PORT': 6379,
|
2015-08-22 22:31:19 +02:00
|
|
|
# The following bots only exist in non-VOYAGER installs
|
|
|
|
'ERROR_BOT': None,
|
|
|
|
'NEW_USER_BOT': None,
|
|
|
|
'NAGIOS_STAGING_SEND_BOT': None,
|
|
|
|
'NAGIOS_STAGING_RECEIVE_BOT': None,
|
|
|
|
'APNS_CERT_FILE': None,
|
2016-06-08 12:32:59 +02:00
|
|
|
'APNS_KEY_FILE': None,
|
2016-08-03 11:11:46 +02:00
|
|
|
'APNS_SANDBOX': True,
|
2015-08-22 22:31:19 +02:00
|
|
|
'ANDROID_GCM_API_KEY': None,
|
|
|
|
'INITIAL_PASSWORD_SALT': None,
|
|
|
|
'FEEDBACK_BOT': 'feedback@zulip.com',
|
|
|
|
'FEEDBACK_BOT_NAME': 'Zulip Feedback Bot',
|
|
|
|
'ADMINS': '',
|
|
|
|
'INLINE_IMAGE_PREVIEW': True,
|
2016-12-08 05:48:19 +01:00
|
|
|
'INLINE_URL_EMBED_PREVIEW': False,
|
2015-08-22 22:31:19 +02:00
|
|
|
'CAMO_URI': '',
|
|
|
|
'ENABLE_FEEDBACK': PRODUCTION,
|
2016-08-24 07:53:05 +02:00
|
|
|
'SEND_MISSED_MESSAGE_EMAILS_AS_USER': False,
|
2017-01-30 23:19:38 +01:00
|
|
|
'SEND_LOGIN_EMAILS': True,
|
2016-08-23 01:22:28 +02:00
|
|
|
'SERVER_EMAIL': None,
|
2015-08-22 22:31:19 +02:00
|
|
|
'FEEDBACK_EMAIL': None,
|
2017-03-06 08:40:34 +01:00
|
|
|
'FEEDBACK_STREAM': None,
|
2016-07-19 07:37:53 +02:00
|
|
|
'WELCOME_EMAIL_SENDER': None,
|
2016-08-13 04:24:45 +02:00
|
|
|
'EMAIL_DELIVERER_DISABLED': False,
|
2015-08-22 22:31:19 +02:00
|
|
|
'ENABLE_GRAVATAR': True,
|
|
|
|
'DEFAULT_AVATAR_URI': '/static/images/default-avatar.png',
|
|
|
|
'AUTH_LDAP_SERVER_URI': "",
|
|
|
|
'EXTERNAL_URI_SCHEME': "https://",
|
|
|
|
'ZULIP_COM': False,
|
2016-07-19 06:49:47 +02:00
|
|
|
'SHOW_OSS_ANNOUNCEMENT': False,
|
2016-07-19 06:52:34 +02:00
|
|
|
'REGISTER_LINK_DISABLED': False,
|
2016-09-14 07:49:51 +02:00
|
|
|
'LOGIN_LINK_DISABLED': False,
|
|
|
|
'ABOUT_LINK_DISABLED': False,
|
2016-12-20 10:41:46 +01:00
|
|
|
'FIND_TEAM_LINK_DISABLED': True,
|
2016-07-19 06:56:45 +02:00
|
|
|
'CUSTOM_LOGO_URL': None,
|
2016-07-19 07:31:59 +02:00
|
|
|
'VERBOSE_SUPPORT_OFFERS': False,
|
2015-08-22 22:18:55 +02:00
|
|
|
'STATSD_HOST': '',
|
2016-06-03 01:02:58 +02:00
|
|
|
'OPEN_REALM_CREATION': False,
|
2016-07-19 14:35:08 +02:00
|
|
|
'REALMS_HAVE_SUBDOMAINS': False,
|
2016-08-14 09:41:34 +02:00
|
|
|
'SUBDOMAINS_HOMEPAGE': False,
|
2016-08-19 05:30:16 +02:00
|
|
|
'ROOT_SUBDOMAIN_ALIASES': ["www"],
|
2015-08-22 22:24:39 +02:00
|
|
|
'REMOTE_POSTGRES_HOST': '',
|
2015-12-10 23:52:52 +01:00
|
|
|
'REMOTE_POSTGRES_SSLMODE': '',
|
2016-08-23 06:06:40 +02:00
|
|
|
# Default GOOGLE_CLIENT_ID to the value needed for Android auth to work
|
|
|
|
'GOOGLE_CLIENT_ID': '835904834568-77mtr5mtmpgspj9b051del9i9r5t4g4n.apps.googleusercontent.com',
|
2016-07-30 00:16:18 +02:00
|
|
|
'SOCIAL_AUTH_GITHUB_KEY': None,
|
2016-08-02 09:42:50 +02:00
|
|
|
'SOCIAL_AUTH_GITHUB_ORG_NAME': None,
|
|
|
|
'SOCIAL_AUTH_GITHUB_TEAM_ID': None,
|
2017-08-07 17:02:02 +02:00
|
|
|
'GOOGLE_OAUTH2_CLIENT_ID': None,
|
2017-05-05 19:54:36 +02:00
|
|
|
'SOCIAL_AUTH_FIELDS_STORED_IN_SESSION': ['subdomain', 'is_signup'],
|
2015-08-22 22:31:19 +02:00
|
|
|
'DBX_APNS_CERT_FILE': None,
|
2016-06-08 12:32:59 +02:00
|
|
|
'DBX_APNS_KEY_FILE': None,
|
2016-08-15 04:00:20 +02:00
|
|
|
'PERSONAL_ZMIRROR_SERVER': None,
|
2017-02-02 22:03:05 +01:00
|
|
|
# Structurally, we will probably eventually merge
|
|
|
|
# analytics into part of the main server, rather
|
|
|
|
# than a separate app.
|
|
|
|
'EXTRA_INSTALLED_APPS': ['analytics'],
|
2017-07-08 06:50:57 +02:00
|
|
|
'CONFIRMATION_LINK_DEFAULT_VALIDITY_DAYS': 1,
|
|
|
|
'INVITATION_LINK_VALIDITY_DAYS': 10,
|
2016-06-22 21:16:02 +02:00
|
|
|
'REALM_CREATION_LINK_VALIDITY_DAYS': 7,
|
2016-05-11 19:01:53 +02:00
|
|
|
'TERMS_OF_SERVICE': None,
|
2017-04-10 12:55:43 +02:00
|
|
|
'PRIVACY_POLICY': None,
|
2016-08-10 03:05:26 +02:00
|
|
|
'TOS_VERSION': None,
|
2017-01-04 09:20:23 +01:00
|
|
|
'SYSTEM_ONLY_REALMS': {"zulip"},
|
2016-04-24 17:08:51 +02:00
|
|
|
'FIRST_TIME_TOS_TEMPLATE': None,
|
|
|
|
'USING_PGROONGA': False,
|
2016-10-17 18:11:16 +02:00
|
|
|
'POST_MIGRATION_CACHE_FLUSHING': False,
|
2016-03-10 17:17:40 +01:00
|
|
|
'ENABLE_FILE_LINKS': False,
|
2016-12-05 21:57:23 +01:00
|
|
|
'USE_WEBSOCKETS': True,
|
2016-10-05 03:38:20 +02:00
|
|
|
'ANALYTICS_LOCK_DIR': "/home/zulip/deployments/analytics-lock-dir",
|
2017-01-09 18:04:23 +01:00
|
|
|
'PASSWORD_MIN_LENGTH': 6,
|
2017-01-18 05:52:52 +01:00
|
|
|
'PASSWORD_MIN_ZXCVBN_QUALITY': 0.5,
|
2017-03-06 12:25:37 +01:00
|
|
|
'OFFLINE_THRESHOLD_SECS': 5 * 60,
|
2016-10-27 23:55:31 +02:00
|
|
|
'PUSH_NOTIFICATION_BOUNCER_URL': None,
|
2015-08-22 22:31:19 +02:00
|
|
|
}
|
|
|
|
|
2016-03-11 10:57:29 +01:00
|
|
|
for setting_name, setting_val in six.iteritems(DEFAULT_SETTINGS):
|
2016-05-10 01:55:43 +02:00
|
|
|
if setting_name not in vars():
|
2015-08-22 22:31:19 +02:00
|
|
|
vars()[setting_name] = setting_val
|
|
|
|
|
2016-07-13 07:32:21 +02:00
|
|
|
# Extend ALLOWED_HOSTS with localhost (needed to RPC to Tornado).
|
|
|
|
ALLOWED_HOSTS += ['127.0.0.1', 'localhost']
|
|
|
|
|
2015-08-22 22:31:19 +02:00
|
|
|
# These are the settings that we will check that the user has filled in for
|
|
|
|
# production deployments before starting the app. It consists of a series
|
|
|
|
# of pairs of (setting name, default value that it must be changed from)
|
|
|
|
REQUIRED_SETTINGS = [("EXTERNAL_HOST", "zulip.example.com"),
|
|
|
|
("ZULIP_ADMINISTRATOR", "zulip-admin@example.com"),
|
|
|
|
# SECRET_KEY doesn't really need to be here, in
|
|
|
|
# that we set it automatically, but just in
|
|
|
|
# case, it seems worth having in this list
|
|
|
|
("SECRET_KEY", ""),
|
|
|
|
("AUTHENTICATION_BACKENDS", ()),
|
|
|
|
]
|
|
|
|
|
|
|
|
if ADMINS == "":
|
|
|
|
ADMINS = (("Zulip Administrator", ZULIP_ADMINISTRATOR),)
|
|
|
|
MANAGERS = ADMINS
|
|
|
|
|
2015-08-28 19:39:57 +02:00
|
|
|
# Voyager is a production zulip server that is not zulip.com or
|
|
|
|
# staging.zulip.com VOYAGER is the standalone all-on-one-server
|
|
|
|
# production deployment model for based on the original Zulip
|
|
|
|
# ENTERPRISE implementation. We expect most users of the open source
|
|
|
|
# project will be using VOYAGER=True in production.
|
|
|
|
VOYAGER = PRODUCTION and not ZULIP_COM
|
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
########################################################################
|
|
|
|
# STANDARD DJANGO SETTINGS
|
|
|
|
########################################################################
|
2012-08-28 18:44:51 +02:00
|
|
|
|
|
|
|
# Local time zone for this installation. Choices can be found here:
|
|
|
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
|
|
|
# although not all choices may be available on all operating systems.
|
|
|
|
# In a Windows environment this must be set to your system time zone.
|
2017-02-26 06:11:21 +01:00
|
|
|
TIME_ZONE = 'UTC'
|
2012-08-28 18:44:51 +02:00
|
|
|
|
|
|
|
# Language code for this installation. All choices can be found here:
|
|
|
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
|
2012-11-01 23:11:32 +01:00
|
|
|
# The ID, as an integer, of the current site in the django_site database table.
|
|
|
|
# This is used so that application data can hook into specific site(s) and a
|
|
|
|
# single database can manage content for multiple sites.
|
|
|
|
#
|
2017-03-15 00:13:00 +01:00
|
|
|
# We set this site's string_id to 'zulip' in populate_db.
|
2012-08-28 18:44:51 +02:00
|
|
|
SITE_ID = 1
|
|
|
|
|
|
|
|
# If you set this to False, Django will make some optimizations so as not
|
|
|
|
# to load the internationalization machinery.
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
# If you set this to False, Django will not format dates, numbers and
|
|
|
|
# calendars according to the current locale.
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
# If you set this to False, Django will not use timezone-aware datetimes.
|
|
|
|
USE_TZ = True
|
|
|
|
|
2013-06-24 20:56:44 +02:00
|
|
|
DEPLOY_ROOT = os.path.join(os.path.realpath(os.path.dirname(__file__)), '..')
|
2016-07-09 18:09:30 +02:00
|
|
|
# this directory will be used to store logs for development environment
|
|
|
|
DEVELOPMENT_LOG_DIRECTORY = os.path.join(DEPLOY_ROOT, 'var', 'log')
|
2012-10-09 23:52:48 +02:00
|
|
|
# Make redirects work properly behind a reverse proxy
|
|
|
|
USE_X_FORWARDED_HOST = True
|
|
|
|
|
2012-08-28 18:44:51 +02:00
|
|
|
# List of callables that know how to import templates from various sources.
|
2016-05-06 11:07:41 +02:00
|
|
|
LOADERS = [
|
2013-11-15 20:51:37 +01:00
|
|
|
'django.template.loaders.filesystem.Loader',
|
|
|
|
'django.template.loaders.app_directories.Loader',
|
2016-05-06 11:07:41 +02:00
|
|
|
]
|
2015-08-21 09:18:44 +02:00
|
|
|
if PRODUCTION:
|
2014-10-28 16:54:54 +01:00
|
|
|
# Template caching is a significant performance win in production.
|
2016-05-08 04:35:13 +02:00
|
|
|
LOADERS = [('django.template.loaders.cached.Loader', LOADERS)]
|
2016-05-06 11:07:41 +02:00
|
|
|
|
2017-06-04 03:33:32 +02:00
|
|
|
base_template_engine_settings = {
|
2017-07-11 07:23:20 +02:00
|
|
|
'BACKEND': 'django.template.backends.jinja2.Jinja2',
|
2017-06-04 03:33:32 +02:00
|
|
|
'OPTIONS': {
|
|
|
|
'environment': 'zproject.jinja2.environment',
|
|
|
|
'extensions': [
|
|
|
|
'jinja2.ext.i18n',
|
|
|
|
'jinja2.ext.autoescape',
|
|
|
|
'pipeline.jinja2.PipelineExtension',
|
|
|
|
'webpack_loader.contrib.jinja2ext.WebpackExtension',
|
|
|
|
],
|
|
|
|
'context_processors': [
|
|
|
|
'zerver.context_processors.zulip_default_context',
|
|
|
|
'zerver.context_processors.add_metrics',
|
|
|
|
'django.template.context_processors.i18n',
|
2016-05-06 11:07:41 +02:00
|
|
|
],
|
2016-04-21 08:48:33 +02:00
|
|
|
},
|
2017-06-04 03:33:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
default_template_engine_settings = deepcopy(base_template_engine_settings)
|
2017-06-06 03:46:35 +02:00
|
|
|
default_template_engine_settings.update({
|
|
|
|
'NAME': 'Jinja2',
|
|
|
|
'DIRS': [
|
|
|
|
os.path.join(DEPLOY_ROOT, 'templates'),
|
|
|
|
os.path.join(DEPLOY_ROOT, 'zerver', 'webhooks'),
|
|
|
|
],
|
|
|
|
'APP_DIRS': True,
|
|
|
|
})
|
|
|
|
|
|
|
|
non_html_template_engine_settings = deepcopy(base_template_engine_settings)
|
|
|
|
non_html_template_engine_settings.update({
|
|
|
|
'NAME': 'Jinja2_plaintext',
|
|
|
|
'DIRS': [os.path.join(DEPLOY_ROOT, 'templates')],
|
|
|
|
'APP_DIRS': False,
|
|
|
|
})
|
|
|
|
non_html_template_engine_settings['OPTIONS'].update({
|
|
|
|
'autoescape': False,
|
2017-06-14 16:06:38 +02:00
|
|
|
'trim_blocks': True,
|
|
|
|
'lstrip_blocks': True,
|
2017-06-06 03:46:35 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
# The order here is important; get_template and related/parent functions try
|
|
|
|
# the template engines in order until one succeeds.
|
2017-06-04 03:33:32 +02:00
|
|
|
TEMPLATES = [
|
|
|
|
default_template_engine_settings,
|
2017-06-06 03:46:35 +02:00
|
|
|
non_html_template_engine_settings,
|
2016-05-06 11:07:41 +02:00
|
|
|
]
|
2012-08-28 18:44:51 +02:00
|
|
|
|
2017-05-18 11:56:03 +02:00
|
|
|
MIDDLEWARE = (
|
2017-01-30 23:19:38 +01:00
|
|
|
# With the exception of it's dependencies,
|
|
|
|
# our logging middleware should be the top middleware item.
|
2013-12-17 22:18:13 +01:00
|
|
|
'zerver.middleware.TagRequests',
|
2017-01-30 23:19:38 +01:00
|
|
|
'zerver.middleware.SetRemoteAddrFromForwardedFor',
|
2013-07-29 23:03:31 +02:00
|
|
|
'zerver.middleware.LogRequests',
|
|
|
|
'zerver.middleware.JsonErrorHandler',
|
|
|
|
'zerver.middleware.RateLimitMiddleware',
|
2013-11-08 21:13:34 +01:00
|
|
|
'zerver.middleware.FlushDisplayRecipientCache',
|
2012-08-28 18:44:51 +02:00
|
|
|
'django.middleware.common.CommonMiddleware',
|
2015-01-16 05:59:20 +01:00
|
|
|
'zerver.middleware.SessionHostDomainMiddleware',
|
2016-04-29 20:03:26 +02:00
|
|
|
'django.middleware.locale.LocaleMiddleware',
|
2012-08-28 18:44:51 +02:00
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
)
|
|
|
|
|
2013-06-22 00:05:48 +02:00
|
|
|
ANONYMOUS_USER_ID = None
|
|
|
|
|
2013-07-29 23:03:31 +02:00
|
|
|
AUTH_USER_MODEL = "zerver.UserProfile"
|
2012-09-21 16:10:36 +02:00
|
|
|
|
2014-01-29 00:47:48 +01:00
|
|
|
TEST_RUNNER = 'zerver.lib.test_runner.Runner'
|
2012-11-14 20:50:47 +01:00
|
|
|
|
2013-08-06 22:51:47 +02:00
|
|
|
ROOT_URLCONF = 'zproject.urls'
|
2012-08-28 18:44:51 +02:00
|
|
|
|
|
|
|
# Python dotted path to the WSGI application used by Django's runserver.
|
2013-08-06 22:51:47 +02:00
|
|
|
WSGI_APPLICATION = 'zproject.wsgi.application'
|
2012-08-28 18:44:51 +02:00
|
|
|
|
2016-04-27 06:28:51 +02:00
|
|
|
# A site can include additional installed apps via the
|
|
|
|
# EXTRA_INSTALLED_APPS setting
|
2013-11-06 21:09:52 +01:00
|
|
|
INSTALLED_APPS = [
|
2012-08-28 18:44:51 +02:00
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.sites',
|
2013-01-30 23:11:34 +01:00
|
|
|
'django.contrib.staticfiles',
|
2012-09-28 22:47:05 +02:00
|
|
|
'confirmation',
|
2013-01-30 23:11:34 +01:00
|
|
|
'pipeline',
|
2017-05-24 00:03:53 +02:00
|
|
|
'webpack_loader',
|
2013-07-29 23:03:31 +02:00
|
|
|
'zerver',
|
2017-01-21 16:52:59 +01:00
|
|
|
'social_django',
|
2016-04-24 17:08:51 +02:00
|
|
|
]
|
|
|
|
if USING_PGROONGA:
|
|
|
|
INSTALLED_APPS += ['pgroonga']
|
|
|
|
INSTALLED_APPS += EXTRA_INSTALLED_APPS
|
2012-08-28 18:44:51 +02:00
|
|
|
|
2016-07-19 06:38:23 +02:00
|
|
|
ZILENCER_ENABLED = 'zilencer' in INSTALLED_APPS
|
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
# Base URL of the Tornado server
|
|
|
|
# We set it to None when running backend tests or populate_db.
|
|
|
|
# We override the port number when running frontend tests.
|
2016-05-08 07:43:45 +02:00
|
|
|
TORNADO_SERVER = 'http://127.0.0.1:9993'
|
2014-10-28 16:54:54 +01:00
|
|
|
RUNNING_INSIDE_TORNADO = False
|
2017-03-18 04:43:27 +01:00
|
|
|
AUTORELOAD = DEBUG
|
2014-10-28 16:54:54 +01:00
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# DATABASE CONFIGURATION
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
DATABASES = {"default": {
|
2017-02-17 08:07:17 +01:00
|
|
|
'ENGINE': 'django.db.backends.postgresql',
|
2014-10-28 16:54:54 +01:00
|
|
|
'NAME': 'zulip',
|
|
|
|
'USER': 'zulip',
|
2017-07-09 01:45:19 +02:00
|
|
|
'PASSWORD': '', # Authentication done via certificates
|
2015-08-21 21:24:34 +02:00
|
|
|
'HOST': '', # Host = '' => connect through a local socket
|
2014-10-28 16:54:54 +01:00
|
|
|
'SCHEMA': 'zulip',
|
|
|
|
'CONN_MAX_AGE': 600,
|
|
|
|
'OPTIONS': {
|
|
|
|
'connection_factory': TimeTrackingConnection
|
|
|
|
},
|
2017-01-24 06:34:26 +01:00
|
|
|
}}
|
2014-10-28 16:54:54 +01:00
|
|
|
|
2015-08-21 21:24:34 +02:00
|
|
|
if DEVELOPMENT:
|
2015-08-20 08:15:21 +02:00
|
|
|
LOCAL_DATABASE_PASSWORD = get_secret("local_database_password")
|
2014-10-28 16:54:54 +01:00
|
|
|
DATABASES["default"].update({
|
2017-01-24 07:06:13 +01:00
|
|
|
'PASSWORD': LOCAL_DATABASE_PASSWORD,
|
|
|
|
'HOST': 'localhost'
|
2017-01-24 06:34:26 +01:00
|
|
|
})
|
2015-08-22 22:24:39 +02:00
|
|
|
elif REMOTE_POSTGRES_HOST != '':
|
|
|
|
DATABASES['default'].update({
|
2017-01-24 07:06:13 +01:00
|
|
|
'HOST': REMOTE_POSTGRES_HOST,
|
2017-01-24 06:34:26 +01:00
|
|
|
})
|
2015-12-10 23:52:52 +01:00
|
|
|
if get_secret("postgres_password") is not None:
|
|
|
|
DATABASES['default'].update({
|
|
|
|
'PASSWORD': get_secret("postgres_password"),
|
2017-01-24 06:34:26 +01:00
|
|
|
})
|
2015-12-10 23:52:52 +01:00
|
|
|
if REMOTE_POSTGRES_SSLMODE != '':
|
|
|
|
DATABASES['default']['OPTIONS']['sslmode'] = REMOTE_POSTGRES_SSLMODE
|
|
|
|
else:
|
|
|
|
DATABASES['default']['OPTIONS']['sslmode'] = 'verify-full'
|
2014-10-28 16:54:54 +01:00
|
|
|
|
2016-04-24 17:08:51 +02:00
|
|
|
if USING_PGROONGA:
|
|
|
|
# We need to have "pgroonga" schema before "pg_catalog" schema in
|
|
|
|
# the PostgreSQL search path, because "pgroonga" schema overrides
|
|
|
|
# the "@@" operator from "pg_catalog" schema, and "pg_catalog"
|
|
|
|
# schema is searched first if not specified in the search path.
|
|
|
|
# See also: http://www.postgresql.org/docs/current/static/runtime-config-client.html
|
|
|
|
pg_options = '-c search_path=%(SCHEMA)s,zulip,public,pgroonga,pg_catalog' % \
|
|
|
|
DATABASES['default']
|
|
|
|
DATABASES['default']['OPTIONS']['options'] = pg_options
|
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
########################################################################
|
|
|
|
# RABBITMQ CONFIGURATION
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
USING_RABBITMQ = True
|
|
|
|
RABBITMQ_PASSWORD = get_secret("rabbitmq_password")
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# CACHING CONFIGURATION
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
|
|
|
|
|
|
|
|
CACHES = {
|
|
|
|
'default': {
|
2017-01-24 06:21:14 +01:00
|
|
|
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
|
2016-01-21 12:52:24 +01:00
|
|
|
'LOCATION': MEMCACHED_LOCATION,
|
2017-01-24 06:21:14 +01:00
|
|
|
'TIMEOUT': 3600,
|
2016-08-12 05:50:39 +02:00
|
|
|
'OPTIONS': {
|
|
|
|
'verify_keys': True,
|
2016-08-12 05:59:47 +02:00
|
|
|
'tcp_nodelay': True,
|
2016-08-12 06:00:06 +02:00
|
|
|
'retry_timeout': 1,
|
2016-08-12 05:50:39 +02:00
|
|
|
}
|
2014-10-28 16:54:54 +01:00
|
|
|
},
|
|
|
|
'database': {
|
2017-01-24 06:21:14 +01:00
|
|
|
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
|
|
|
|
'LOCATION': 'third_party_api_results',
|
2014-10-28 16:54:54 +01:00
|
|
|
# Basically never timeout. Setting to 0 isn't guaranteed
|
|
|
|
# to work, see https://code.djangoproject.com/ticket/9595
|
|
|
|
'TIMEOUT': 2000000000,
|
|
|
|
'OPTIONS': {
|
|
|
|
'MAX_ENTRIES': 100000000,
|
|
|
|
'CULL_FREQUENCY': 10,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# REDIS-BASED RATE LIMITING CONFIGURATION
|
|
|
|
########################################################################
|
|
|
|
|
2013-05-29 23:58:07 +02:00
|
|
|
RATE_LIMITING_RULES = [
|
2017-07-09 01:45:19 +02:00
|
|
|
(60, 100), # 100 requests max every minute
|
2017-01-24 06:34:26 +01:00
|
|
|
]
|
2016-07-30 04:29:58 +02:00
|
|
|
DEBUG_RATE_LIMITING = DEBUG
|
2016-08-01 04:51:00 +02:00
|
|
|
REDIS_PASSWORD = get_secret('redis_password')
|
2013-05-29 23:58:07 +02:00
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
########################################################################
|
|
|
|
# SECURITY SETTINGS
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
# Tell the browser to never send our cookies without encryption, e.g.
|
|
|
|
# when executing the initial http -> https redirect.
|
|
|
|
#
|
|
|
|
# Turn it off for local testing because we don't have SSL.
|
2015-08-21 09:18:44 +02:00
|
|
|
if PRODUCTION:
|
2014-10-28 16:54:54 +01:00
|
|
|
SESSION_COOKIE_SECURE = True
|
2016-05-10 01:53:12 +02:00
|
|
|
CSRF_COOKIE_SECURE = True
|
2014-10-28 16:54:54 +01:00
|
|
|
|
|
|
|
try:
|
|
|
|
# For get_updates hostname sharding.
|
|
|
|
domain = config_file.get('django', 'cookie_domain')
|
|
|
|
SESSION_COOKIE_DOMAIN = '.' + domain
|
2016-05-10 01:53:12 +02:00
|
|
|
CSRF_COOKIE_DOMAIN = '.' + domain
|
2015-11-01 17:14:36 +01:00
|
|
|
except six.moves.configparser.Error:
|
2014-10-28 16:54:54 +01:00
|
|
|
# Failing here is OK
|
|
|
|
pass
|
|
|
|
|
|
|
|
# Prevent Javascript from reading the CSRF token from cookies. Our code gets
|
|
|
|
# the token from the DOM, which means malicious code could too. But hiding the
|
|
|
|
# cookie will slow down some attackers.
|
|
|
|
CSRF_COOKIE_PATH = '/;HttpOnly'
|
|
|
|
CSRF_FAILURE_VIEW = 'zerver.middleware.csrf_failure'
|
|
|
|
|
2015-08-21 09:18:44 +02:00
|
|
|
if DEVELOPMENT:
|
2014-10-28 16:54:54 +01:00
|
|
|
# Use fast password hashing for creating testing users when not
|
2015-08-21 09:18:44 +02:00
|
|
|
# PRODUCTION. Saves a bunch of time.
|
2014-10-28 16:54:54 +01:00
|
|
|
PASSWORD_HASHERS = (
|
2017-01-24 07:06:13 +01:00
|
|
|
'django.contrib.auth.hashers.SHA1PasswordHasher',
|
|
|
|
'django.contrib.auth.hashers.PBKDF2PasswordHasher'
|
|
|
|
)
|
2015-08-20 08:15:21 +02:00
|
|
|
# Also we auto-generate passwords for the default users which you
|
|
|
|
# can query using ./manage.py print_initial_password
|
|
|
|
INITIAL_PASSWORD_SALT = get_secret("initial_password_salt")
|
2017-01-20 20:12:33 +01:00
|
|
|
else:
|
|
|
|
# For production, use the best password hashing algorithm: Argon2
|
|
|
|
# Zulip was originally on PBKDF2 so we need it for compatibility
|
|
|
|
PASSWORD_HASHERS = ('django.contrib.auth.hashers.Argon2PasswordHasher',
|
|
|
|
'django.contrib.auth.hashers.PBKDF2PasswordHasher')
|
2014-10-28 16:54:54 +01:00
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# API/BOT SETTINGS
|
|
|
|
########################################################################
|
|
|
|
|
2013-12-04 20:38:01 +01:00
|
|
|
if "EXTERNAL_API_PATH" not in vars():
|
|
|
|
EXTERNAL_API_PATH = EXTERNAL_HOST + "/api"
|
|
|
|
EXTERNAL_API_URI = EXTERNAL_URI_SCHEME + EXTERNAL_API_PATH
|
2016-08-14 00:57:45 +02:00
|
|
|
SERVER_URI = EXTERNAL_URI_SCHEME + EXTERNAL_HOST
|
2013-12-04 20:38:01 +01:00
|
|
|
|
2016-10-29 05:52:05 +02:00
|
|
|
if "NAGIOS_BOT_HOST" not in vars():
|
|
|
|
NAGIOS_BOT_HOST = EXTERNAL_HOST
|
|
|
|
|
2015-08-21 03:24:55 +02:00
|
|
|
S3_KEY = get_secret("s3_key")
|
|
|
|
S3_SECRET_KEY = get_secret("s3_secret_key")
|
|
|
|
|
2015-08-21 01:48:50 +02:00
|
|
|
# GCM tokens are IP-whitelisted; if we deploy to additional
|
|
|
|
# servers you will need to explicitly add their IPs here:
|
|
|
|
# https://cloud.google.com/console/project/apps~zulip-android/apiui/credential
|
|
|
|
ANDROID_GCM_API_KEY = get_secret("android_gcm_api_key")
|
|
|
|
|
2015-08-21 07:10:04 +02:00
|
|
|
GOOGLE_OAUTH2_CLIENT_SECRET = get_secret('google_oauth2_client_secret')
|
|
|
|
|
2015-08-21 05:24:21 +02:00
|
|
|
DROPBOX_APP_KEY = get_secret("dropbox_app_key")
|
|
|
|
|
2015-08-21 07:12:15 +02:00
|
|
|
MAILCHIMP_API_KEY = get_secret("mailchimp_api_key")
|
|
|
|
|
2015-08-21 05:02:07 +02:00
|
|
|
# Twitter API credentials
|
|
|
|
# Secrecy not required because its only used for R/O requests.
|
|
|
|
# Please don't make us go over our rate limit.
|
|
|
|
TWITTER_CONSUMER_KEY = get_secret("twitter_consumer_key")
|
|
|
|
TWITTER_CONSUMER_SECRET = get_secret("twitter_consumer_secret")
|
|
|
|
TWITTER_ACCESS_TOKEN_KEY = get_secret("twitter_access_token_key")
|
|
|
|
TWITTER_ACCESS_TOKEN_SECRET = get_secret("twitter_access_token_secret")
|
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
# These are the bots that Zulip sends automated messages as.
|
2016-05-10 01:53:12 +02:00
|
|
|
INTERNAL_BOTS = [{'var_name': 'NOTIFICATION_BOT',
|
|
|
|
'email_template': 'notification-bot@%s',
|
|
|
|
'name': 'Notification Bot'},
|
|
|
|
{'var_name': 'EMAIL_GATEWAY_BOT',
|
|
|
|
'email_template': 'emailgateway@%s',
|
|
|
|
'name': 'Email Gateway'},
|
|
|
|
{'var_name': 'NAGIOS_SEND_BOT',
|
|
|
|
'email_template': 'nagios-send-bot@%s',
|
|
|
|
'name': 'Nagios Send Bot'},
|
|
|
|
{'var_name': 'NAGIOS_RECEIVE_BOT',
|
|
|
|
'email_template': 'nagios-receive-bot@%s',
|
|
|
|
'name': 'Nagios Receive Bot'},
|
2016-10-26 18:21:24 +02:00
|
|
|
{'var_name': 'WELCOME_BOT',
|
|
|
|
'email_template': 'welcome-bot@%s',
|
|
|
|
'name': 'Welcome Bot'}]
|
|
|
|
|
|
|
|
if PRODUCTION:
|
|
|
|
INTERNAL_BOTS += [
|
2017-01-24 07:06:13 +01:00
|
|
|
{'var_name': 'NAGIOS_STAGING_SEND_BOT',
|
|
|
|
'email_template': 'nagios-staging-send-bot@%s',
|
|
|
|
'name': 'Nagios Staging Send Bot'},
|
|
|
|
{'var_name': 'NAGIOS_STAGING_RECEIVE_BOT',
|
|
|
|
'email_template': 'nagios-staging-receive-bot@%s',
|
|
|
|
'name': 'Nagios Staging Receive Bot'},
|
2017-01-24 06:02:39 +01:00
|
|
|
]
|
2013-11-14 16:59:10 +01:00
|
|
|
|
|
|
|
INTERNAL_BOT_DOMAIN = "zulip.com"
|
2013-10-31 18:33:19 +01:00
|
|
|
|
|
|
|
# Set the realm-specific bot names
|
2013-11-14 16:59:10 +01:00
|
|
|
for bot in INTERNAL_BOTS:
|
2016-04-13 17:50:19 +02:00
|
|
|
if vars().get(bot['var_name']) is None:
|
2013-11-14 16:59:10 +01:00
|
|
|
bot_email = bot['email_template'] % (INTERNAL_BOT_DOMAIN,)
|
2016-05-10 01:53:12 +02:00
|
|
|
vars()[bot['var_name']] = bot_email
|
2013-10-31 18:33:19 +01:00
|
|
|
|
2013-12-04 22:37:49 +01:00
|
|
|
if EMAIL_GATEWAY_PATTERN != "":
|
|
|
|
EMAIL_GATEWAY_EXAMPLE = EMAIL_GATEWAY_PATTERN % ("support+abcdefg",)
|
2013-11-12 23:31:52 +01:00
|
|
|
|
2015-08-21 07:12:15 +02:00
|
|
|
DEPLOYMENT_ROLE_KEY = get_secret("deployment_role_key")
|
|
|
|
|
2015-08-21 18:58:43 +02:00
|
|
|
########################################################################
|
|
|
|
# STATSD CONFIGURATION
|
|
|
|
########################################################################
|
|
|
|
|
2015-08-22 22:18:55 +02:00
|
|
|
# Statsd is not super well supported; if you want to use it you'll need
|
|
|
|
# to set STATSD_HOST and STATSD_PREFIX.
|
|
|
|
if STATSD_HOST != '':
|
2015-08-21 18:58:43 +02:00
|
|
|
INSTALLED_APPS += ['django_statsd']
|
|
|
|
STATSD_PORT = 8125
|
|
|
|
STATSD_CLIENT = 'django_statsd.clients.normal'
|
|
|
|
|
2015-08-21 01:27:35 +02:00
|
|
|
########################################################################
|
|
|
|
# CAMO HTTPS CACHE CONFIGURATION
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
if CAMO_URI != '':
|
|
|
|
# This needs to be synced with the Camo installation
|
|
|
|
CAMO_KEY = get_secret("camo_key")
|
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
########################################################################
|
|
|
|
# STATIC CONTENT AND MINIFICATION SETTINGS
|
|
|
|
########################################################################
|
2013-01-30 23:11:34 +01:00
|
|
|
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
|
2013-08-06 21:36:30 +02:00
|
|
|
# ZulipStorage is a modified version of PipelineCachedStorage,
|
2013-06-20 19:44:44 +02:00
|
|
|
# and, like that class, it inserts a file hash into filenames
|
2013-02-24 19:28:43 +01:00
|
|
|
# to prevent the browser from using stale files from cache.
|
2013-02-25 23:19:20 +01:00
|
|
|
#
|
|
|
|
# Unlike PipelineStorage, it requires the files to exist in
|
|
|
|
# STATIC_ROOT even for dev servers. So we only use
|
2013-08-06 21:36:30 +02:00
|
|
|
# ZulipStorage when not DEBUG.
|
2013-02-25 23:19:20 +01:00
|
|
|
|
2013-07-26 20:14:54 +02:00
|
|
|
# This is the default behavior from Pipeline, but we set it
|
|
|
|
# here so that urls.py can read it.
|
2016-07-04 09:33:57 +02:00
|
|
|
PIPELINE_ENABLED = not DEBUG
|
2013-07-26 20:14:54 +02:00
|
|
|
|
2013-11-12 20:37:23 +01:00
|
|
|
if DEBUG:
|
2013-02-25 23:19:20 +01:00
|
|
|
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
|
2013-06-12 19:33:53 +02:00
|
|
|
STATICFILES_FINDERS = (
|
|
|
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
2016-07-04 09:33:57 +02:00
|
|
|
'pipeline.finders.PipelineFinder',
|
2013-06-12 19:33:53 +02:00
|
|
|
)
|
2016-07-04 09:33:57 +02:00
|
|
|
if PIPELINE_ENABLED:
|
2016-07-01 00:24:50 +02:00
|
|
|
STATIC_ROOT = os.path.abspath('prod-static/serve')
|
2013-07-26 20:14:54 +02:00
|
|
|
else:
|
2016-07-01 00:24:50 +02:00
|
|
|
STATIC_ROOT = os.path.abspath('static/')
|
2013-02-25 23:19:20 +01:00
|
|
|
else:
|
2013-08-06 21:36:30 +02:00
|
|
|
STATICFILES_STORAGE = 'zerver.storage.ZulipStorage'
|
2013-06-12 19:33:53 +02:00
|
|
|
STATICFILES_FINDERS = (
|
2016-07-04 13:33:16 +02:00
|
|
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
|
|
'pipeline.finders.PipelineFinder',
|
2013-06-12 19:33:53 +02:00
|
|
|
)
|
2015-08-21 11:24:18 +02:00
|
|
|
if PRODUCTION:
|
2013-10-04 19:19:57 +02:00
|
|
|
STATIC_ROOT = '/home/zulip/prod-static'
|
2013-06-12 19:56:12 +02:00
|
|
|
else:
|
2016-07-01 00:24:50 +02:00
|
|
|
STATIC_ROOT = os.path.abspath('prod-static/serve')
|
2013-01-30 23:11:34 +01:00
|
|
|
|
2017-02-04 02:06:58 +01:00
|
|
|
# If changing this, you need to also the hack modifications to this in
|
|
|
|
# our compilemessages management command.
|
2016-07-14 12:00:26 +02:00
|
|
|
LOCALE_PATHS = (os.path.join(STATIC_ROOT, 'locale'),)
|
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
# We want all temporary uploaded files to be stored on disk.
|
|
|
|
FILE_UPLOAD_MAX_MEMORY_SIZE = 0
|
|
|
|
|
2013-07-25 22:41:44 +02:00
|
|
|
STATICFILES_DIRS = ['static/']
|
2013-07-29 23:03:31 +02:00
|
|
|
STATIC_HEADER_FILE = 'zerver/static_header.txt'
|
2013-01-30 23:11:34 +01:00
|
|
|
|
2016-07-04 09:33:57 +02:00
|
|
|
# To use minified files in dev, set PIPELINE_ENABLED = True. For the full
|
2013-06-24 16:45:57 +02:00
|
|
|
# cache-busting behavior, you must also set DEBUG = False.
|
2013-02-24 19:57:01 +01:00
|
|
|
#
|
2013-10-25 23:20:40 +02:00
|
|
|
# You will need to run update-prod-static after changing
|
2013-06-24 16:45:57 +02:00
|
|
|
# static files.
|
2017-03-05 06:12:59 +01:00
|
|
|
#
|
|
|
|
# Useful reading on how this works is in
|
|
|
|
# https://zulip.readthedocs.io/en/latest/front-end-build-process.html
|
2013-02-24 19:57:01 +01:00
|
|
|
|
2016-07-04 09:33:57 +02:00
|
|
|
PIPELINE = {
|
|
|
|
'PIPELINE_ENABLED': PIPELINE_ENABLED,
|
|
|
|
'CSS_COMPRESSOR': 'pipeline.compressors.yui.YUICompressor',
|
|
|
|
'YUI_BINARY': '/usr/bin/env yui-compressor',
|
|
|
|
'STYLESHEETS': {
|
2016-07-30 06:51:27 +02:00
|
|
|
# If you add a style here, please update stylesheets()
|
2016-07-30 17:38:55 +02:00
|
|
|
# in frontend_tests/zjsunit/output.js as needed.
|
2016-07-04 09:33:57 +02:00
|
|
|
'activity': {
|
|
|
|
'source_filenames': ('styles/activity.css',),
|
2017-01-24 06:21:14 +01:00
|
|
|
'output_filename': 'min/activity.css'
|
2016-07-04 09:33:57 +02:00
|
|
|
},
|
2017-01-11 21:44:59 +01:00
|
|
|
'stats': {
|
|
|
|
'source_filenames': ('styles/stats.css',),
|
|
|
|
'output_filename': 'min/stats.css'
|
|
|
|
},
|
2016-07-04 09:33:57 +02:00
|
|
|
'portico': {
|
|
|
|
'source_filenames': (
|
|
|
|
'third/zocial/zocial.css',
|
|
|
|
'styles/portico.css',
|
2017-04-20 21:02:56 +02:00
|
|
|
'styles/portico-signin.css',
|
2016-07-04 09:33:57 +02:00
|
|
|
'styles/pygments.css',
|
2017-03-19 00:22:09 +01:00
|
|
|
'third/thirdparty-fonts.css',
|
2016-07-04 09:33:57 +02:00
|
|
|
'styles/fonts.css',
|
|
|
|
),
|
|
|
|
'output_filename': 'min/portico.css'
|
|
|
|
},
|
2017-02-28 01:45:25 +01:00
|
|
|
'landing-page': {
|
|
|
|
'source_filenames': (
|
|
|
|
'styles/landing-page.css',
|
|
|
|
),
|
|
|
|
'output_filename': 'min/landing.css'
|
|
|
|
},
|
2016-07-04 09:33:57 +02:00
|
|
|
# Two versions of the app CSS exist because of QTBUG-3467
|
|
|
|
'app-fontcompat': {
|
|
|
|
'source_filenames': (
|
|
|
|
'third/bootstrap-notify/css/bootstrap-notify.css',
|
|
|
|
'third/spectrum/spectrum.css',
|
2017-03-30 02:32:33 +02:00
|
|
|
'third/thirdparty-fonts.css',
|
2016-09-28 02:48:24 +02:00
|
|
|
'styles/components.css',
|
2016-07-04 09:33:57 +02:00
|
|
|
'styles/zulip.css',
|
2017-03-23 20:37:08 +01:00
|
|
|
'styles/alerts.css',
|
2016-07-04 09:33:57 +02:00
|
|
|
'styles/settings.css',
|
2016-10-26 06:13:39 +02:00
|
|
|
'styles/subscriptions.css',
|
2017-02-22 02:34:05 +01:00
|
|
|
'styles/drafts.css',
|
2017-01-10 01:15:18 +01:00
|
|
|
'styles/informational-overlays.css',
|
2016-10-27 07:40:53 +02:00
|
|
|
'styles/compose.css',
|
2016-12-02 13:23:23 +01:00
|
|
|
'styles/reactions.css',
|
2016-10-28 07:12:32 +02:00
|
|
|
'styles/left-sidebar.css',
|
2017-01-04 00:37:01 +01:00
|
|
|
'styles/right-sidebar.css',
|
2017-03-18 00:53:58 +01:00
|
|
|
'styles/lightbox.css',
|
2017-03-23 00:54:00 +01:00
|
|
|
'styles/popovers.css',
|
2016-07-04 09:33:57 +02:00
|
|
|
'styles/pygments.css',
|
2016-10-31 19:34:40 +01:00
|
|
|
'styles/media.css',
|
2016-10-12 20:57:59 +02:00
|
|
|
'styles/typing_notifications.css',
|
2017-07-14 03:16:50 +02:00
|
|
|
'styles/hotspots.css',
|
2016-07-04 09:33:57 +02:00
|
|
|
# We don't want fonts.css on QtWebKit, so its omitted here
|
|
|
|
),
|
|
|
|
'output_filename': 'min/app-fontcompat.css'
|
|
|
|
},
|
|
|
|
'app': {
|
|
|
|
'source_filenames': (
|
|
|
|
'third/bootstrap-notify/css/bootstrap-notify.css',
|
|
|
|
'third/spectrum/spectrum.css',
|
2017-03-30 02:32:33 +02:00
|
|
|
'third/thirdparty-fonts.css',
|
2017-03-20 16:56:39 +01:00
|
|
|
'node_modules/katex/dist/katex.css',
|
2016-09-28 02:48:24 +02:00
|
|
|
'styles/components.css',
|
2016-07-04 09:33:57 +02:00
|
|
|
'styles/zulip.css',
|
2017-03-23 20:37:08 +01:00
|
|
|
'styles/alerts.css',
|
2016-07-04 09:33:57 +02:00
|
|
|
'styles/settings.css',
|
2016-10-26 06:13:39 +02:00
|
|
|
'styles/subscriptions.css',
|
2017-02-22 02:34:05 +01:00
|
|
|
'styles/drafts.css',
|
2017-01-10 01:15:18 +01:00
|
|
|
'styles/informational-overlays.css',
|
2016-10-27 07:40:53 +02:00
|
|
|
'styles/compose.css',
|
2016-12-02 13:23:23 +01:00
|
|
|
'styles/reactions.css',
|
2016-10-28 07:12:32 +02:00
|
|
|
'styles/left-sidebar.css',
|
2017-01-04 00:37:01 +01:00
|
|
|
'styles/right-sidebar.css',
|
2017-03-18 00:53:58 +01:00
|
|
|
'styles/lightbox.css',
|
2017-03-23 00:54:00 +01:00
|
|
|
'styles/popovers.css',
|
2016-07-04 09:33:57 +02:00
|
|
|
'styles/pygments.css',
|
|
|
|
'styles/fonts.css',
|
2016-10-31 19:34:40 +01:00
|
|
|
'styles/media.css',
|
2016-10-12 20:57:59 +02:00
|
|
|
'styles/typing_notifications.css',
|
2017-07-14 03:16:50 +02:00
|
|
|
'styles/hotspots.css',
|
2016-07-04 09:33:57 +02:00
|
|
|
),
|
|
|
|
'output_filename': 'min/app.css'
|
|
|
|
},
|
|
|
|
'common': {
|
|
|
|
'source_filenames': (
|
|
|
|
'third/bootstrap/css/bootstrap.css',
|
|
|
|
'third/bootstrap/css/bootstrap-btn.css',
|
|
|
|
'third/bootstrap/css/bootstrap-responsive.css',
|
2017-07-10 20:50:11 +02:00
|
|
|
'node_modules/perfect-scrollbar/dist/css/perfect-scrollbar.css',
|
2016-07-04 09:33:57 +02:00
|
|
|
),
|
|
|
|
'output_filename': 'min/common.css'
|
|
|
|
},
|
2017-05-10 04:11:02 +02:00
|
|
|
'apple_sprite': {
|
|
|
|
'source_filenames': (
|
|
|
|
'generated/emoji/google_sprite.css',
|
|
|
|
),
|
|
|
|
'output_filename': 'min/google_sprite.css',
|
|
|
|
},
|
|
|
|
'emojione_sprite': {
|
|
|
|
'source_filenames': (
|
|
|
|
'generated/emoji/google_sprite.css',
|
|
|
|
),
|
|
|
|
'output_filename': 'min/google_sprite.css',
|
|
|
|
},
|
|
|
|
'google_sprite': {
|
|
|
|
'source_filenames': (
|
|
|
|
'generated/emoji/google_sprite.css',
|
|
|
|
),
|
|
|
|
'output_filename': 'min/google_sprite.css',
|
|
|
|
},
|
|
|
|
'twitter_sprite': {
|
|
|
|
'source_filenames': (
|
|
|
|
'generated/emoji/google_sprite.css',
|
|
|
|
),
|
|
|
|
'output_filename': 'min/google_sprite.css',
|
|
|
|
},
|
2013-04-06 00:19:32 +02:00
|
|
|
},
|
2016-07-04 09:33:57 +02:00
|
|
|
'JAVASCRIPT': {},
|
2013-01-30 23:11:34 +01:00
|
|
|
}
|
2017-01-10 20:07:16 +01:00
|
|
|
|
2017-03-05 06:12:59 +01:00
|
|
|
# Useful reading on how this works is in
|
|
|
|
# https://zulip.readthedocs.io/en/latest/front-end-build-process.html
|
Reuse minified JS from previous deploys
This is a big change affecting lots of areas:
* Pipeline no longer deals with JS (though it still minifies CSS)
* A new script, tools/minify-js (called from update-prod-static),
minifies JavaScripts
* A command-line argument --prev-deploy, if passed to minify-js or
update-prod-static, is used to copy minified JS from a previous
deploy (i.e., a previous git checkout), if the source files have
not changed
* update-deployment passes --prev-deploy
* Scripts are now included with the minified_js template tag, rather
than Pipeline's compressed_js
Also, as a side benefit of this commit, our Handlebars templates will
no longer be copied into prod-static/ and accessible in production.
Unminification is probably broken, but, per Zev and Trac ticket #1377,
it wasn't working perfectly before this change either.
(Based on code review, this commit has been revised to:
* Warn if git returns an error in minify-js
* Add missing output redirects in update-prod-static
* Use DEPLOY_ROOT instead of manually constructing that directory
* Use old style formatting)
(imported from commit e67722ea252756db8519d5c0bd6a421d59374185)
2013-07-03 22:42:25 +02:00
|
|
|
JS_SPECS = {
|
2013-01-30 23:11:34 +01:00
|
|
|
'app': {
|
2013-02-16 11:17:23 +01:00
|
|
|
'source_filenames': [
|
2013-06-19 01:41:27 +02:00
|
|
|
'third/bootstrap-notify/js/bootstrap-notify.js',
|
2013-06-25 21:54:24 +02:00
|
|
|
'third/html5-formdata/formdata.js',
|
2016-08-25 23:21:15 +02:00
|
|
|
'node_modules/jquery-validation/dist/jquery.validate.js',
|
2017-01-17 20:51:30 +01:00
|
|
|
'node_modules/clipboard/dist/clipboard.js',
|
2013-05-28 21:46:16 +02:00
|
|
|
'third/jquery-form/jquery.form.js',
|
|
|
|
'third/jquery-filedrop/jquery.filedrop.js',
|
2016-06-14 22:49:41 +02:00
|
|
|
'third/jquery-caret/jquery.caret.1.5.2.js',
|
2017-01-08 10:13:27 +01:00
|
|
|
'node_modules/xdate/src/xdate.js',
|
2013-05-28 21:46:16 +02:00
|
|
|
'third/jquery-throttle-debounce/jquery.ba-throttle-debounce.js',
|
|
|
|
'third/jquery-idle/jquery.idle.js',
|
|
|
|
'third/jquery-autosize/jquery.autosize.js',
|
2017-01-09 07:52:45 +01:00
|
|
|
'node_modules/perfect-scrollbar/dist/js/perfect-scrollbar.jquery.js',
|
2013-08-26 18:35:25 +02:00
|
|
|
'third/lazyload/lazyload.js',
|
2013-05-28 21:46:16 +02:00
|
|
|
'third/spectrum/spectrum.js',
|
2017-01-10 20:07:16 +01:00
|
|
|
'third/sockjs/sockjs-0.3.4.js',
|
2017-01-08 07:43:10 +01:00
|
|
|
'node_modules/string.prototype.codepointat/codepointat.js',
|
2017-01-08 06:24:14 +01:00
|
|
|
'node_modules/winchan/winchan.js',
|
2017-01-10 08:32:11 +01:00
|
|
|
'node_modules/handlebars/dist/handlebars.runtime.js',
|
2013-12-13 19:58:31 +01:00
|
|
|
'third/marked/lib/marked.js',
|
2017-01-26 00:41:53 +01:00
|
|
|
'generated/emoji/emoji_codes.js',
|
2017-04-26 09:32:46 +02:00
|
|
|
'generated/pygments_data.js',
|
2014-01-09 23:51:32 +01:00
|
|
|
'templates/compiled.js',
|
2013-08-01 17:59:23 +02:00
|
|
|
'js/feature_flags.js',
|
2014-03-13 15:03:01 +01:00
|
|
|
'js/loading.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/util.js',
|
2017-04-05 02:10:04 +02:00
|
|
|
'js/dynamic_text.js',
|
2017-06-08 22:58:15 +02:00
|
|
|
'js/lightbox_canvas.js',
|
2017-04-17 23:40:36 +02:00
|
|
|
'js/rtl.js',
|
2013-08-07 22:28:45 +02:00
|
|
|
'js/dict.js',
|
2016-11-04 22:34:12 +01:00
|
|
|
'js/components.js',
|
2014-01-16 16:42:30 +01:00
|
|
|
'js/localstorage.js',
|
2017-02-22 02:34:05 +01:00
|
|
|
'js/drafts.js',
|
2013-12-18 19:55:18 +01:00
|
|
|
'js/channel.js',
|
2014-03-13 15:56:46 +01:00
|
|
|
'js/setup.js',
|
2016-11-14 17:14:59 +01:00
|
|
|
'js/unread_ui.js',
|
2017-03-18 01:41:56 +01:00
|
|
|
'js/unread_ops.js',
|
2013-08-20 22:05:56 +02:00
|
|
|
'js/muting.js',
|
2013-09-10 20:07:24 +02:00
|
|
|
'js/muting_ui.js',
|
2017-03-10 23:48:51 +01:00
|
|
|
'js/message_viewport.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/rows.js',
|
2016-11-01 20:20:54 +01:00
|
|
|
'js/people.js',
|
2013-05-17 21:32:26 +02:00
|
|
|
'js/unread.js',
|
2016-10-27 01:02:41 +02:00
|
|
|
'js/topic_list.js',
|
2016-11-11 12:33:51 +01:00
|
|
|
'js/pm_list.js',
|
2017-06-01 07:46:23 +02:00
|
|
|
'js/pm_conversations.js',
|
2017-06-01 07:42:57 +02:00
|
|
|
'js/recent_senders.js',
|
2017-04-18 17:08:59 +02:00
|
|
|
'js/stream_sort.js',
|
2017-04-21 20:42:10 +02:00
|
|
|
'js/topic_generator.js',
|
2017-08-12 17:26:12 +02:00
|
|
|
'js/top_left_corner.js',
|
2013-05-06 02:54:15 +02:00
|
|
|
'js/stream_list.js',
|
2013-08-10 01:31:31 +02:00
|
|
|
'js/filter.js',
|
2016-05-24 22:05:16 +02:00
|
|
|
'js/message_list_view.js',
|
|
|
|
'js/message_list.js',
|
2017-01-05 17:34:27 +01:00
|
|
|
'js/message_live_update.js',
|
2017-04-25 15:25:31 +02:00
|
|
|
'js/narrow_state.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/narrow.js',
|
|
|
|
'js/reload.js',
|
2013-08-11 21:21:47 +02:00
|
|
|
'js/compose_fade.js',
|
2014-01-27 23:20:50 +01:00
|
|
|
'js/fenced_code.js',
|
2017-05-09 18:01:43 +02:00
|
|
|
'js/markdown.js',
|
2013-12-04 17:16:08 +01:00
|
|
|
'js/echo.js',
|
2013-09-10 20:39:46 +02:00
|
|
|
'js/socket.js',
|
sending messages: Extract sent_messages.js.
This commit extract send_messages.js to clean up code related
to the following things:
* sending data to /json/report_send_time
* restarting the event loop if events don't arrive on time
The code related to /json/report changes the following ways:
* We track the state almost completely in the new
send_messages.js module, with other modules just
making one-line calls.
* We no longer send "displayed" times to the servers, since
we were kind of lying about them anyway.
* We now explicitly track the state of each single sent
message in its own object.
* We now look up data related to the messages by local_id,
instead of message_id. The problem with message_id was
that is was mutable. Now we use local_id, and we extend
the local_id concept to messages that don't get rendered
client side. We no longer need to react to the
'message_id_changed' event to change our hash key.
* The code used to live in many places:
* various big chunks were scattered among compose.js,
and those were all moved or reduced to one-line
calls into the new module
* echo.js continues to make basically one-line calls,
but it no longer calls compose.report_as_received(),
nor does it set the "start" time.
* message_util.js used to report received events, but
only when they finally got drawn in the home view;
this code is gone now
The code related to restarting the event loop if events don't arrive
changes as follows:
* The timer now gets set up from within
send_messages.message_state.report_server_ack,
where we can easily inspect the current state of the
possibly-still-in-flight message.
* The code to confirm that an event was received happens now
in server_events.js, rather than later, so that we don't
falsely blame the event loop for a downstream bug. (Plus
it's easier to just do it one place.)
This change removes a fair amount of code from our node tests. Some
of the removal is good stuff related to us completing killing off
unnecessary code. Other removals are more expediency-driven, and
we should make another sweep at ramping up our coverage on compose.js,
with possibly a little more mocking of the new `send_messages` code
layer, since it's now abstracted better.
There is also some minor cleanup to echo.resend_message() in this
commit.
See #5968 for a detailed breakdown of the changes.
2017-07-30 12:56:46 +02:00
|
|
|
'js/sent_messages.js',
|
2017-04-15 01:15:59 +02:00
|
|
|
'js/compose_state.js',
|
2017-04-14 16:26:00 +02:00
|
|
|
'js/compose_actions.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/compose.js',
|
2013-08-07 19:28:06 +02:00
|
|
|
'js/stream_color.js',
|
2013-08-15 21:11:07 +02:00
|
|
|
'js/stream_data.js',
|
2017-07-24 18:22:37 +02:00
|
|
|
'js/topic_data.js',
|
2017-03-19 16:00:35 +01:00
|
|
|
'js/stream_muting.js',
|
2017-03-19 16:03:07 +01:00
|
|
|
'js/stream_events.js',
|
2017-04-22 22:22:25 +02:00
|
|
|
'js/stream_create.js',
|
2017-04-24 04:11:25 +02:00
|
|
|
'js/stream_edit.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/subs.js',
|
2013-05-15 00:22:16 +02:00
|
|
|
'js/message_edit.js',
|
2014-03-13 20:22:09 +01:00
|
|
|
'js/condense.js',
|
2014-03-13 19:03:31 +01:00
|
|
|
'js/resize.js',
|
2017-03-16 21:00:56 +01:00
|
|
|
'js/list_rendering.js',
|
2014-03-13 21:14:33 +01:00
|
|
|
'js/floating_recipient_bar.js',
|
2017-03-18 00:50:39 +01:00
|
|
|
'js/lightbox.js',
|
2017-04-03 16:13:25 +02:00
|
|
|
'js/ui_report.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/ui.js',
|
2017-03-18 21:35:35 +01:00
|
|
|
'js/ui_util.js',
|
2016-04-12 17:38:47 +02:00
|
|
|
'js/pointer.js',
|
2014-03-14 15:30:29 +01:00
|
|
|
'js/click_handlers.js',
|
2014-03-13 19:16:11 +01:00
|
|
|
'js/scroll_bar.js',
|
2014-03-13 21:55:47 +01:00
|
|
|
'js/gear_menu.js',
|
2014-03-13 22:07:56 +01:00
|
|
|
'js/copy_and_paste.js',
|
2017-03-05 17:28:40 +01:00
|
|
|
'js/stream_popover.js',
|
2013-06-28 22:38:40 +02:00
|
|
|
'js/popovers.js',
|
2017-05-27 15:40:54 +02:00
|
|
|
'js/overlays.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/typeahead_helper.js',
|
2013-07-30 23:02:10 +02:00
|
|
|
'js/search_suggestion.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/search.js',
|
|
|
|
'js/composebox_typeahead.js',
|
2013-07-24 22:51:13 +02:00
|
|
|
'js/navigate.js',
|
2017-04-04 18:14:27 +02:00
|
|
|
'js/list_util.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/hotkey.js',
|
2014-03-13 17:44:43 +01:00
|
|
|
'js/favicon.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/notifications.js',
|
2017-03-19 00:43:14 +01:00
|
|
|
'js/hash_util.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/hashchange.js',
|
|
|
|
'js/invite.js',
|
2014-01-31 17:03:52 +01:00
|
|
|
'js/message_flags.js',
|
2013-09-20 20:26:53 +02:00
|
|
|
'js/alert_words.js',
|
|
|
|
'js/alert_words_ui.js',
|
2016-12-28 14:46:42 +01:00
|
|
|
'js/attachments_ui.js',
|
2014-01-31 16:27:24 +01:00
|
|
|
'js/message_store.js',
|
2017-03-19 22:43:38 +01:00
|
|
|
'js/message_util.js',
|
2017-03-19 20:23:48 +01:00
|
|
|
'js/message_events.js',
|
2017-03-19 18:19:48 +01:00
|
|
|
'js/message_fetch.js',
|
2014-01-30 19:25:25 +01:00
|
|
|
'js/server_events.js',
|
2017-05-31 08:53:09 +02:00
|
|
|
'js/server_events_dispatch.js',
|
2013-07-29 22:48:16 +02:00
|
|
|
'js/zulip.js',
|
2017-03-30 20:04:01 +02:00
|
|
|
'js/presence.js',
|
2013-02-07 19:57:45 +01:00
|
|
|
'js/activity.js',
|
2017-01-21 16:49:27 +01:00
|
|
|
'js/user_events.js',
|
2013-02-16 09:43:27 +01:00
|
|
|
'js/colorspace.js',
|
2013-01-14 17:26:50 +01:00
|
|
|
'js/timerender.js',
|
2013-02-13 22:04:35 +01:00
|
|
|
'js/tutorial.js',
|
2017-01-24 01:48:35 +01:00
|
|
|
'js/hotspots.js',
|
2013-02-16 10:45:32 +01:00
|
|
|
'js/templates.js',
|
2017-02-21 03:15:22 +01:00
|
|
|
'js/upload_widget.js',
|
2013-07-29 17:29:25 +02:00
|
|
|
'js/avatar.js',
|
2017-02-21 03:41:20 +01:00
|
|
|
'js/realm_icon.js',
|
2017-04-06 02:28:57 +02:00
|
|
|
'js/settings_account.js',
|
2017-04-06 15:34:42 +02:00
|
|
|
'js/settings_display.js',
|
2017-04-06 16:01:07 +02:00
|
|
|
'js/settings_notifications.js',
|
2017-04-06 22:47:27 +02:00
|
|
|
'js/settings_bots.js',
|
2017-04-06 16:56:52 +02:00
|
|
|
'js/settings_muting.js',
|
2017-04-06 17:47:36 +02:00
|
|
|
'js/settings_lab.js',
|
2017-04-07 01:30:13 +02:00
|
|
|
'js/settings_sections.js',
|
2017-04-08 17:24:07 +02:00
|
|
|
'js/settings_emoji.js',
|
2017-04-08 18:13:39 +02:00
|
|
|
'js/settings_org.js',
|
2017-04-08 20:08:35 +02:00
|
|
|
'js/settings_users.js',
|
2017-04-08 21:02:08 +02:00
|
|
|
'js/settings_streams.js',
|
2017-04-08 23:24:03 +02:00
|
|
|
'js/settings_filters.js',
|
2013-05-09 21:12:53 +02:00
|
|
|
'js/settings.js',
|
2017-04-17 16:51:27 +02:00
|
|
|
'js/admin_sections.js',
|
2017-02-26 20:03:58 +01:00
|
|
|
'js/admin.js',
|
2013-05-09 21:12:53 +02:00
|
|
|
'js/tab_bar.js',
|
2013-07-26 16:51:02 +02:00
|
|
|
'js/emoji.js',
|
2014-01-17 20:18:53 +01:00
|
|
|
'js/custom_markdown.js',
|
2014-02-27 00:01:18 +01:00
|
|
|
'js/bot_data.js',
|
2016-12-02 13:23:23 +01:00
|
|
|
'js/reactions.js',
|
2016-10-12 20:57:59 +02:00
|
|
|
'js/typing.js',
|
2017-03-22 00:41:09 +01:00
|
|
|
'js/typing_status.js',
|
2017-03-21 17:45:10 +01:00
|
|
|
'js/typing_data.js',
|
2017-03-22 15:11:41 +01:00
|
|
|
'js/typing_events.js',
|
2017-03-18 20:29:55 +01:00
|
|
|
'js/ui_init.js',
|
2017-04-27 07:27:25 +02:00
|
|
|
'js/emoji_picker.js',
|
2017-04-23 08:51:26 +02:00
|
|
|
'js/compose_ui.js',
|
2013-02-16 11:17:23 +01:00
|
|
|
],
|
2013-01-30 23:11:34 +01:00
|
|
|
'output_filename': 'min/app.js'
|
|
|
|
},
|
2013-09-07 00:27:10 +02:00
|
|
|
# We also want to minify sockjs separately for the sockjs iframe transport
|
|
|
|
'sockjs': {
|
2017-01-20 01:42:42 +01:00
|
|
|
'source_filenames': ['third/sockjs/sockjs-0.3.4.js'],
|
2017-01-10 20:07:16 +01:00
|
|
|
'output_filename': 'min/sockjs-0.3.4.min.js'
|
2017-03-20 16:56:39 +01:00
|
|
|
}
|
2013-01-30 23:11:34 +01:00
|
|
|
}
|
|
|
|
|
2013-11-14 00:28:45 +01:00
|
|
|
app_srcs = JS_SPECS['app']['source_filenames']
|
2017-07-18 21:47:47 +02:00
|
|
|
if DEVELOPMENT:
|
|
|
|
WEBPACK_STATS_FILE = os.path.join('var', 'webpack-stats-dev.json')
|
|
|
|
else:
|
|
|
|
WEBPACK_STATS_FILE = 'webpack-stats-production.json'
|
2017-05-24 00:03:53 +02:00
|
|
|
WEBPACK_LOADER = {
|
|
|
|
'DEFAULT': {
|
|
|
|
'BUNDLE_DIR_NAME': 'webpack-bundles/',
|
2017-07-18 21:47:47 +02:00
|
|
|
'STATS_FILE': os.path.join(DEPLOY_ROOT, WEBPACK_STATS_FILE),
|
2017-05-24 00:03:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
########################################################################
|
|
|
|
# LOGGING SETTINGS
|
|
|
|
########################################################################
|
2012-09-19 17:58:22 +02:00
|
|
|
|
2013-11-26 00:01:14 +01:00
|
|
|
ZULIP_PATHS = [
|
|
|
|
("SERVER_LOG_PATH", "/var/log/zulip/server.log"),
|
2013-12-16 21:44:50 +01:00
|
|
|
("ERROR_FILE_LOG_PATH", "/var/log/zulip/errors.log"),
|
2013-11-26 00:01:14 +01:00
|
|
|
("MANAGEMENT_LOG_PATH", "/var/log/zulip/manage.log"),
|
|
|
|
("WORKER_LOG_PATH", "/var/log/zulip/workers.log"),
|
|
|
|
("PERSISTENT_QUEUE_FILENAME", "/home/zulip/tornado/event_queues.pickle"),
|
|
|
|
("JSON_PERSISTENT_QUEUE_FILENAME", "/home/zulip/tornado/event_queues.json"),
|
2016-07-28 16:08:52 +02:00
|
|
|
("EMAIL_MIRROR_LOG_PATH", "/var/log/zulip/email_mirror.log"),
|
2013-11-26 00:01:14 +01:00
|
|
|
("EMAIL_DELIVERER_LOG_PATH", "/var/log/zulip/email-deliverer.log"),
|
|
|
|
("LDAP_SYNC_LOG_PATH", "/var/log/zulip/sync_ldap_user_data.log"),
|
|
|
|
("QUEUE_ERROR_DIR", "/var/log/zulip/queue_error"),
|
|
|
|
("STATS_DIR", "/home/zulip/stats"),
|
2013-12-16 23:03:09 +01:00
|
|
|
("DIGEST_LOG_PATH", "/var/log/zulip/digest.log"),
|
2016-10-13 22:52:39 +02:00
|
|
|
("ANALYTICS_LOG_PATH", "/var/log/zulip/analytics.log"),
|
2017-05-12 05:21:09 +02:00
|
|
|
("API_KEY_ONLY_WEBHOOK_LOG_PATH", "/var/log/zulip/webhooks_errors.log"),
|
2017-01-24 06:34:26 +01:00
|
|
|
]
|
2013-11-26 00:01:14 +01:00
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
# The Event log basically logs most significant database changes,
|
|
|
|
# which can be useful for debugging.
|
2016-08-12 20:09:38 +02:00
|
|
|
if EVENT_LOGS_ENABLED:
|
2013-11-26 00:01:14 +01:00
|
|
|
ZULIP_PATHS.append(("EVENT_LOG_DIR", "/home/zulip/logs/event_log"))
|
2016-08-12 20:09:38 +02:00
|
|
|
else:
|
|
|
|
EVENT_LOG_DIR = None
|
2013-10-29 20:03:42 +01:00
|
|
|
|
2013-11-26 00:01:14 +01:00
|
|
|
for (var, path) in ZULIP_PATHS:
|
2015-08-21 09:18:44 +02:00
|
|
|
if DEVELOPMENT:
|
|
|
|
# if DEVELOPMENT, store these files in the Zulip checkout
|
2016-07-09 18:09:30 +02:00
|
|
|
path = os.path.join(DEVELOPMENT_LOG_DIRECTORY, os.path.basename(path))
|
2016-07-16 14:47:15 +02:00
|
|
|
# only `JSON_PERSISTENT_QUEUE_FILENAME` will be stored in `var`
|
|
|
|
if var == 'JSON_PERSISTENT_QUEUE_FILENAME':
|
|
|
|
path = os.path.join(os.path.join(DEPLOY_ROOT, 'var'), os.path.basename(path))
|
2013-11-26 00:01:14 +01:00
|
|
|
vars()[var] = path
|
2013-04-09 22:01:38 +02:00
|
|
|
|
2013-10-30 16:01:18 +01:00
|
|
|
ZULIP_WORKER_TEST_FILE = '/tmp/zulip-worker-test-file'
|
|
|
|
|
|
|
|
|
2014-01-07 22:27:52 +01:00
|
|
|
if IS_WORKER:
|
2013-09-26 23:06:01 +02:00
|
|
|
FILE_LOG_PATH = WORKER_LOG_PATH
|
|
|
|
else:
|
|
|
|
FILE_LOG_PATH = SERVER_LOG_PATH
|
2017-03-22 22:09:38 +01:00
|
|
|
# Used for test_logging_handlers
|
|
|
|
LOGGING_NOT_DISABLED = True
|
2013-09-26 23:06:01 +02:00
|
|
|
|
2017-03-21 08:37:39 +01:00
|
|
|
DEFAULT_ZULIP_HANDLERS = (
|
|
|
|
(['zulip_admins'] if ERROR_REPORTING else []) +
|
|
|
|
['console', 'file', 'errors_file']
|
|
|
|
)
|
|
|
|
|
2012-08-28 18:44:51 +02:00
|
|
|
LOGGING = {
|
|
|
|
'version': 1,
|
2012-10-16 22:52:51 +02:00
|
|
|
'disable_existing_loggers': True,
|
2012-09-18 22:40:19 +02:00
|
|
|
'formatters': {
|
|
|
|
'default': {
|
|
|
|
'format': '%(asctime)s %(levelname)-8s %(message)s'
|
|
|
|
}
|
|
|
|
},
|
2012-12-05 18:01:43 +01:00
|
|
|
'filters': {
|
2013-08-06 21:37:34 +02:00
|
|
|
'ZulipLimiter': {
|
|
|
|
'()': 'zerver.lib.logging_util.ZulipLimiter',
|
2012-12-06 22:00:34 +01:00
|
|
|
},
|
|
|
|
'EmailLimiter': {
|
2013-07-29 23:03:31 +02:00
|
|
|
'()': 'zerver.lib.logging_util.EmailLimiter',
|
2012-12-06 22:00:34 +01:00
|
|
|
},
|
|
|
|
'require_debug_false': {
|
|
|
|
'()': 'django.utils.log.RequireDebugFalse',
|
2013-03-15 17:03:56 +01:00
|
|
|
},
|
2017-01-19 07:45:01 +01:00
|
|
|
'require_debug_true': {
|
|
|
|
'()': 'django.utils.log.RequireDebugTrue',
|
|
|
|
},
|
2013-03-15 17:03:56 +01:00
|
|
|
'nop': {
|
2013-07-29 23:03:31 +02:00
|
|
|
'()': 'zerver.lib.logging_util.ReturnTrue',
|
2013-03-15 17:03:56 +01:00
|
|
|
},
|
2017-03-22 22:09:38 +01:00
|
|
|
'require_logging_enabled': {
|
|
|
|
'()': 'zerver.lib.logging_util.ReturnEnabled',
|
|
|
|
},
|
2013-06-10 18:59:10 +02:00
|
|
|
'require_really_deployed': {
|
2013-07-29 23:03:31 +02:00
|
|
|
'()': 'zerver.lib.logging_util.RequireReallyDeployed',
|
2013-06-10 18:59:10 +02:00
|
|
|
},
|
2017-01-18 12:52:01 +01:00
|
|
|
'skip_200_and_304': {
|
|
|
|
'()': 'django.utils.log.CallbackFilter',
|
|
|
|
'callback': zerver.lib.logging_util.skip_200_and_304,
|
|
|
|
},
|
2017-03-15 10:08:27 +01:00
|
|
|
'skip_site_packages_logs': {
|
|
|
|
'()': 'django.utils.log.CallbackFilter',
|
|
|
|
'callback': zerver.lib.logging_util.skip_site_packages_logs,
|
|
|
|
},
|
2012-12-05 18:01:43 +01:00
|
|
|
},
|
2012-09-18 22:40:19 +02:00
|
|
|
'handlers': {
|
2013-08-06 22:30:41 +02:00
|
|
|
'zulip_admins': {
|
2017-01-24 06:21:14 +01:00
|
|
|
'level': 'ERROR',
|
|
|
|
'class': 'zerver.logging_handlers.AdminZulipHandler',
|
2013-03-15 17:03:56 +01:00
|
|
|
# For testing the handler delete the next line
|
2017-01-24 06:21:14 +01:00
|
|
|
'filters': ['ZulipLimiter', 'require_debug_false', 'require_really_deployed'],
|
2012-12-06 22:00:34 +01:00
|
|
|
'formatter': 'default'
|
|
|
|
},
|
2012-09-18 22:40:19 +02:00
|
|
|
'console': {
|
2017-01-24 06:21:14 +01:00
|
|
|
'level': 'DEBUG',
|
|
|
|
'class': 'logging.StreamHandler',
|
2012-09-18 22:40:19 +02:00
|
|
|
'formatter': 'default'
|
2012-10-12 23:47:43 +02:00
|
|
|
},
|
|
|
|
'file': {
|
2017-01-24 06:21:14 +01:00
|
|
|
'level': 'DEBUG',
|
|
|
|
'class': 'logging.handlers.WatchedFileHandler',
|
|
|
|
'formatter': 'default',
|
|
|
|
'filename': FILE_LOG_PATH,
|
2012-12-05 18:01:43 +01:00
|
|
|
},
|
2013-12-16 21:44:50 +01:00
|
|
|
'errors_file': {
|
2017-01-24 06:21:14 +01:00
|
|
|
'level': 'WARNING',
|
|
|
|
'class': 'logging.handlers.WatchedFileHandler',
|
|
|
|
'formatter': 'default',
|
|
|
|
'filename': ERROR_FILE_LOG_PATH,
|
2013-12-16 21:44:50 +01:00
|
|
|
},
|
2012-09-18 22:40:19 +02:00
|
|
|
},
|
|
|
|
'loggers': {
|
2012-10-09 17:41:13 +02:00
|
|
|
'': {
|
2017-03-21 08:37:39 +01:00
|
|
|
'handlers': DEFAULT_ZULIP_HANDLERS,
|
2017-03-22 22:09:38 +01:00
|
|
|
'filters': ['require_logging_enabled'],
|
2017-01-24 06:21:14 +01:00
|
|
|
'level': 'INFO',
|
2013-03-27 22:07:45 +01:00
|
|
|
'propagate': False,
|
|
|
|
},
|
|
|
|
'django': {
|
2017-03-21 08:37:39 +01:00
|
|
|
'handlers': DEFAULT_ZULIP_HANDLERS,
|
2017-01-24 06:21:14 +01:00
|
|
|
'level': 'INFO',
|
2013-03-27 22:07:45 +01:00
|
|
|
'propagate': False,
|
|
|
|
},
|
2013-08-06 22:51:47 +02:00
|
|
|
'zulip.requests': {
|
2017-03-21 08:37:39 +01:00
|
|
|
'handlers': DEFAULT_ZULIP_HANDLERS,
|
2017-01-24 06:21:14 +01:00
|
|
|
'level': 'INFO',
|
2013-03-27 22:07:45 +01:00
|
|
|
'propagate': False,
|
2013-03-15 18:13:03 +01:00
|
|
|
},
|
2015-12-14 07:07:46 +01:00
|
|
|
'zulip.queue': {
|
2017-03-21 08:37:39 +01:00
|
|
|
'handlers': DEFAULT_ZULIP_HANDLERS,
|
2017-01-24 06:21:14 +01:00
|
|
|
'level': 'WARNING',
|
2015-12-14 07:07:46 +01:00
|
|
|
'propagate': False,
|
|
|
|
},
|
2013-11-19 00:04:45 +01:00
|
|
|
'zulip.management': {
|
2013-12-16 21:44:50 +01:00
|
|
|
'handlers': ['file', 'errors_file'],
|
2017-01-24 06:21:14 +01:00
|
|
|
'level': 'INFO',
|
2013-11-19 00:04:45 +01:00
|
|
|
'propagate': False,
|
|
|
|
},
|
2015-12-14 07:13:42 +01:00
|
|
|
'requests': {
|
2017-03-21 08:37:39 +01:00
|
|
|
'handlers': DEFAULT_ZULIP_HANDLERS,
|
2017-01-24 06:21:14 +01:00
|
|
|
'level': 'WARNING',
|
2015-12-14 07:13:42 +01:00
|
|
|
'propagate': False,
|
|
|
|
},
|
2016-08-19 01:57:05 +02:00
|
|
|
'django.security.DisallowedHost': {
|
|
|
|
'handlers': ['file'],
|
|
|
|
'propagate': False,
|
|
|
|
},
|
2017-01-18 12:52:01 +01:00
|
|
|
'django.server': {
|
2017-02-17 23:35:23 +01:00
|
|
|
'handlers': ['console', 'file'],
|
2017-01-18 12:52:01 +01:00
|
|
|
'propagate': False,
|
|
|
|
'filters': ['skip_200_and_304'],
|
|
|
|
},
|
2017-01-19 07:45:01 +01:00
|
|
|
'django.template': {
|
|
|
|
'handlers': ['console'],
|
2017-03-15 10:08:27 +01:00
|
|
|
'filters': ['require_debug_true', 'skip_site_packages_logs'],
|
2017-01-19 07:45:01 +01:00
|
|
|
'level': 'DEBUG',
|
|
|
|
'propagate': False,
|
2017-05-12 05:21:09 +02:00
|
|
|
},
|
|
|
|
'zulip.zerver.webhooks': {
|
|
|
|
'handlers': ['file', 'errors_file'],
|
|
|
|
'level': 'INFO',
|
|
|
|
'propagate': False,
|
2017-01-19 07:45:01 +01:00
|
|
|
},
|
2013-03-15 18:13:03 +01:00
|
|
|
## Uncomment the following to get all database queries logged to the console
|
|
|
|
# 'django.db': {
|
|
|
|
# 'handlers': ['console'],
|
|
|
|
# 'level': 'DEBUG',
|
2013-03-27 22:07:45 +01:00
|
|
|
# 'propagate': False,
|
2013-03-15 18:13:03 +01:00
|
|
|
# },
|
2012-09-18 22:40:19 +02:00
|
|
|
}
|
2012-08-28 18:44:51 +02:00
|
|
|
}
|
|
|
|
|
2016-05-10 01:53:12 +02:00
|
|
|
ACCOUNT_ACTIVATION_DAYS = 7
|
2012-10-01 21:03:59 +02:00
|
|
|
|
2016-05-10 01:53:12 +02:00
|
|
|
LOGIN_REDIRECT_URL = '/'
|
2012-09-27 19:58:42 +02:00
|
|
|
|
2013-03-28 22:38:45 +01:00
|
|
|
# Client-side polling timeout for get_events, in milliseconds.
|
2012-12-11 18:08:18 +01:00
|
|
|
# We configure this here so that the client test suite can override it.
|
2013-03-28 22:38:45 +01:00
|
|
|
# We already kill the connection server-side with heartbeat events,
|
|
|
|
# but it's good to have a safety. This value should be greater than
|
|
|
|
# (HEARTBEAT_MIN_FREQ_SECS + 10)
|
|
|
|
POLL_TIMEOUT = 90 * 1000
|
2012-12-11 18:08:18 +01:00
|
|
|
|
2015-08-19 01:02:31 +02:00
|
|
|
# iOS App IDs
|
2017-08-15 02:39:02 +02:00
|
|
|
ZULIP_IOS_APP_ID = 'org.zulip.Zulip'
|
2015-08-19 01:02:31 +02:00
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
########################################################################
|
|
|
|
# SSO AND LDAP SETTINGS
|
|
|
|
########################################################################
|
|
|
|
|
2015-08-19 04:36:24 +02:00
|
|
|
USING_APACHE_SSO = ('zproject.backends.ZulipRemoteUserBackend' in AUTHENTICATION_BACKENDS)
|
2013-11-13 22:35:14 +01:00
|
|
|
|
2016-12-28 05:16:12 +01:00
|
|
|
if len(AUTHENTICATION_BACKENDS) == 1 and (AUTHENTICATION_BACKENDS[0] ==
|
|
|
|
"zproject.backends.ZulipRemoteUserBackend"):
|
2013-11-13 17:21:41 +01:00
|
|
|
HOME_NOT_LOGGED_IN = "/accounts/login/sso"
|
2013-11-13 23:11:59 +01:00
|
|
|
ONLY_SSO = True
|
2013-11-13 17:21:41 +01:00
|
|
|
else:
|
|
|
|
HOME_NOT_LOGGED_IN = '/login'
|
2013-11-14 14:15:23 +01:00
|
|
|
ONLY_SSO = False
|
2013-11-21 04:57:23 +01:00
|
|
|
AUTHENTICATION_BACKENDS += ('zproject.backends.ZulipDummyBackend',)
|
2013-11-13 17:21:41 +01:00
|
|
|
|
2017-03-18 01:58:45 +01:00
|
|
|
# Redirect to /devlogin by default in dev mode
|
|
|
|
if DEVELOPMENT:
|
|
|
|
HOME_NOT_LOGGED_IN = '/devlogin'
|
|
|
|
LOGIN_URL = '/devlogin'
|
|
|
|
|
2013-11-26 00:44:37 +01:00
|
|
|
POPULATE_PROFILE_VIA_LDAP = bool(AUTH_LDAP_SERVER_URI)
|
2013-11-21 01:30:20 +01:00
|
|
|
|
|
|
|
if POPULATE_PROFILE_VIA_LDAP and \
|
2016-05-10 01:55:43 +02:00
|
|
|
'zproject.backends.ZulipLDAPAuthBackend' not in AUTHENTICATION_BACKENDS:
|
2013-11-21 01:30:20 +01:00
|
|
|
AUTHENTICATION_BACKENDS += ('zproject.backends.ZulipLDAPUserPopulator',)
|
|
|
|
else:
|
|
|
|
POPULATE_PROFILE_VIA_LDAP = 'zproject.backends.ZulipLDAPAuthBackend' in AUTHENTICATION_BACKENDS or POPULATE_PROFILE_VIA_LDAP
|
|
|
|
|
2016-07-20 13:33:27 +02:00
|
|
|
########################################################################
|
|
|
|
# GITHUB AUTHENTICATION SETTINGS
|
|
|
|
########################################################################
|
2016-07-30 00:16:18 +02:00
|
|
|
|
|
|
|
# SOCIAL_AUTH_GITHUB_KEY is set in /etc/zulip/settings.py
|
2016-07-20 13:33:27 +02:00
|
|
|
SOCIAL_AUTH_GITHUB_SECRET = get_secret('social_auth_github_secret')
|
|
|
|
SOCIAL_AUTH_LOGIN_ERROR_URL = '/login/'
|
2017-05-24 11:15:22 +02:00
|
|
|
SOCIAL_AUTH_GITHUB_SCOPE = ['user:email']
|
2016-08-02 09:42:50 +02:00
|
|
|
SOCIAL_AUTH_GITHUB_ORG_KEY = SOCIAL_AUTH_GITHUB_KEY
|
|
|
|
SOCIAL_AUTH_GITHUB_ORG_SECRET = SOCIAL_AUTH_GITHUB_SECRET
|
|
|
|
SOCIAL_AUTH_GITHUB_TEAM_KEY = SOCIAL_AUTH_GITHUB_KEY
|
|
|
|
SOCIAL_AUTH_GITHUB_TEAM_SECRET = SOCIAL_AUTH_GITHUB_SECRET
|
2016-07-20 13:33:27 +02:00
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
########################################################################
|
|
|
|
# EMAIL SETTINGS
|
|
|
|
########################################################################
|
|
|
|
|
2017-06-28 06:03:17 +02:00
|
|
|
# Django setting. Not used in the Zulip codebase.
|
|
|
|
DEFAULT_FROM_EMAIL = ZULIP_ADMINISTRATOR
|
|
|
|
|
2017-02-22 06:15:27 +01:00
|
|
|
if EMAIL_BACKEND is not None:
|
|
|
|
# If the server admin specified a custom email backend, use that.
|
|
|
|
pass
|
|
|
|
elif not EMAIL_HOST and PRODUCTION:
|
|
|
|
# If an email host is not specified, fail silently and gracefully
|
2013-11-05 01:19:52 +01:00
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
|
2015-08-21 09:18:44 +02:00
|
|
|
elif DEVELOPMENT:
|
2014-10-28 16:54:54 +01:00
|
|
|
# In the dev environment, emails are printed to the run-dev.py console.
|
2012-10-01 21:03:59 +02:00
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
2013-11-05 01:19:52 +01:00
|
|
|
else:
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
2012-10-20 21:25:33 +02:00
|
|
|
|
2015-08-21 07:12:15 +02:00
|
|
|
EMAIL_HOST_PASSWORD = get_secret('email_password')
|
2016-06-01 00:05:02 +02:00
|
|
|
if EMAIL_GATEWAY_PASSWORD is None:
|
2015-11-23 22:20:32 +01:00
|
|
|
EMAIL_GATEWAY_PASSWORD = get_secret('email_gateway_password')
|
2016-06-01 00:05:22 +02:00
|
|
|
if vars().get("AUTH_LDAP_BIND_PASSWORD") is None:
|
2015-11-23 22:28:00 +01:00
|
|
|
AUTH_LDAP_BIND_PASSWORD = get_secret('auth_ldap_bind_password')
|
2015-08-21 07:12:15 +02:00
|
|
|
|
2016-08-23 01:22:28 +02:00
|
|
|
# Set the sender email address for Django traceback error reporting
|
|
|
|
if SERVER_EMAIL is None:
|
2017-06-28 04:59:17 +02:00
|
|
|
SERVER_EMAIL = ZULIP_ADMINISTRATOR
|
2016-08-23 01:22:28 +02:00
|
|
|
|
2014-10-28 16:54:54 +01:00
|
|
|
########################################################################
|
|
|
|
# MISC SETTINGS
|
|
|
|
########################################################################
|
2012-12-07 23:00:13 +01:00
|
|
|
|
2015-08-21 09:18:44 +02:00
|
|
|
if PRODUCTION:
|
2012-12-07 23:00:13 +01:00
|
|
|
# Filter out user data
|
2013-08-06 21:38:05 +02:00
|
|
|
DEFAULT_EXCEPTION_REPORTER_FILTER = 'zerver.filters.ZulipExceptionReporterFilter'
|
2013-03-14 22:12:25 +01:00
|
|
|
|
2013-11-18 18:55:19 +01:00
|
|
|
# This is a debugging option only
|
|
|
|
PROFILE_ALL_REQUESTS = False
|
2015-01-31 07:55:18 +01:00
|
|
|
|
2017-06-11 18:34:25 +02:00
|
|
|
CROSS_REALM_BOT_EMAILS = set(('feedback@zulip.com', 'notification-bot@zulip.com', 'welcome-bot@zulip.com'))
|
2017-01-06 18:56:36 +01:00
|
|
|
|
|
|
|
CONTRIBUTORS_DATA = os.path.join(STATIC_ROOT, 'generated/github-contributors.json')
|