mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
Move all remaining calls of get_secret from local_settings.py to settings.py.
(imported from commit 099a122121f8e06568cef3579f955cb73b20ee50)
This commit is contained in:
@@ -15,26 +15,10 @@ TESTING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'te
|
|||||||
|
|
||||||
ENTERPRISE = DEPLOYED and config_file.get('machine', 'deploy_type') == 'enterprise'
|
ENTERPRISE = DEPLOYED and config_file.get('machine', 'deploy_type') == 'enterprise'
|
||||||
|
|
||||||
secrets_file = ConfigParser.RawConfigParser()
|
|
||||||
if DEPLOYED:
|
|
||||||
secrets_file.read("/etc/zulip/zulip-secrets.conf")
|
|
||||||
else:
|
|
||||||
secrets_file.read("zproject/dev-secrets.conf")
|
|
||||||
|
|
||||||
def get_secret(key):
|
|
||||||
if secrets_file.has_option('secrets', key):
|
|
||||||
return secrets_file.get('secrets', key)
|
|
||||||
return None
|
|
||||||
|
|
||||||
MAILCHIMP_API_KEY = get_secret("mailchimp_api_key")
|
|
||||||
ZULIP_FRIENDS_LIST_ID = '84b2f3da6b'
|
ZULIP_FRIENDS_LIST_ID = '84b2f3da6b'
|
||||||
|
|
||||||
# This can be filled in automatically from the database, maybe
|
# This can be filled in automatically from the database, maybe
|
||||||
DEPLOYMENT_ROLE_NAME = 'zulip.com'
|
DEPLOYMENT_ROLE_NAME = 'zulip.com'
|
||||||
DEPLOYMENT_ROLE_KEY = get_secret("deployment_role_key")
|
|
||||||
|
|
||||||
# This comes from our mandrill accounts page
|
|
||||||
MANDRILL_API_KEY = get_secret("mandrill_api_key")
|
|
||||||
|
|
||||||
# XXX: replace me
|
# XXX: replace me
|
||||||
CAMO_URI = 'https://external-content.zulipcdn.net/'
|
CAMO_URI = 'https://external-content.zulipcdn.net/'
|
||||||
@@ -42,7 +26,6 @@ CAMO_URI = 'https://external-content.zulipcdn.net/'
|
|||||||
# Leave EMAIL_HOST unset or empty if you do not wish for emails to be sent
|
# Leave EMAIL_HOST unset or empty if you do not wish for emails to be sent
|
||||||
EMAIL_HOST = 'smtp.gmail.com'
|
EMAIL_HOST = 'smtp.gmail.com'
|
||||||
EMAIL_HOST_USER = 'zulip@zulip.com'
|
EMAIL_HOST_USER = 'zulip@zulip.com'
|
||||||
EMAIL_HOST_PASSWORD = get_secret('email_password')
|
|
||||||
EMAIL_PORT = 587
|
EMAIL_PORT = 587
|
||||||
EMAIL_USE_TLS = True
|
EMAIL_USE_TLS = True
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,17 @@ STAGING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'st
|
|||||||
TESTING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'test'
|
TESTING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'test'
|
||||||
ENTERPRISE = DEPLOYED and config_file.get('machine', 'deploy_type') == 'enterprise'
|
ENTERPRISE = DEPLOYED and config_file.get('machine', 'deploy_type') == 'enterprise'
|
||||||
|
|
||||||
|
secrets_file = ConfigParser.RawConfigParser()
|
||||||
|
if DEPLOYED:
|
||||||
|
secrets_file.read("/etc/zulip/zulip-secrets.conf")
|
||||||
|
else:
|
||||||
|
secrets_file.read("zproject/dev-secrets.conf")
|
||||||
|
|
||||||
|
def get_secret(key):
|
||||||
|
if secrets_file.has_option('secrets', key):
|
||||||
|
return secrets_file.get('secrets', key)
|
||||||
|
return None
|
||||||
|
|
||||||
# Import variables like secrets from the local_settings file
|
# Import variables like secrets from the local_settings file
|
||||||
# Import local_settings after determining the deployment/machine type
|
# Import local_settings after determining the deployment/machine type
|
||||||
from local_settings import *
|
from local_settings import *
|
||||||
@@ -435,6 +446,11 @@ GOOGLE_OAUTH2_CLIENT_SECRET = get_secret('google_oauth2_client_secret')
|
|||||||
|
|
||||||
DROPBOX_APP_KEY = get_secret("dropbox_app_key")
|
DROPBOX_APP_KEY = get_secret("dropbox_app_key")
|
||||||
|
|
||||||
|
MAILCHIMP_API_KEY = get_secret("mailchimp_api_key")
|
||||||
|
|
||||||
|
# This comes from our mandrill accounts page
|
||||||
|
MANDRILL_API_KEY = get_secret("mandrill_api_key")
|
||||||
|
|
||||||
# Twitter API credentials
|
# Twitter API credentials
|
||||||
# Secrecy not required because its only used for R/O requests.
|
# Secrecy not required because its only used for R/O requests.
|
||||||
# Please don't make us go over our rate limit.
|
# Please don't make us go over our rate limit.
|
||||||
@@ -473,6 +489,8 @@ if EMAIL_GATEWAY_BOT not in API_SUPER_USERS:
|
|||||||
if EMAIL_GATEWAY_PATTERN != "":
|
if EMAIL_GATEWAY_PATTERN != "":
|
||||||
EMAIL_GATEWAY_EXAMPLE = EMAIL_GATEWAY_PATTERN % ("support+abcdefg",)
|
EMAIL_GATEWAY_EXAMPLE = EMAIL_GATEWAY_PATTERN % ("support+abcdefg",)
|
||||||
|
|
||||||
|
DEPLOYMENT_ROLE_KEY = get_secret("deployment_role_key")
|
||||||
|
|
||||||
if DEPLOYED:
|
if DEPLOYED:
|
||||||
FEEDBACK_TARGET="https://zulip.com/api"
|
FEEDBACK_TARGET="https://zulip.com/api"
|
||||||
else:
|
else:
|
||||||
@@ -917,6 +935,8 @@ elif not DEPLOYED:
|
|||||||
else:
|
else:
|
||||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||||
|
|
||||||
|
EMAIL_HOST_PASSWORD = get_secret('email_password')
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# MISC SETTINGS
|
# MISC SETTINGS
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user