Add dummy secrets for use in development.

We also reference these secrets from zproject/local_settings.py, keying
off IS_DEPLOYED.

(imported from commit eb83310e219616ed1c6c253f0d6893134bbe3517)
This commit is contained in:
Luke Faraone 2015-08-16 21:35:34 -07:00
parent 2fb2300d1b
commit f5089e535d
2 changed files with 21 additions and 5 deletions

13
zproject/dev-secrets.conf Normal file
View File

@ -0,0 +1,13 @@
[secrets]
secret_key = dummy
shared_secret = dummy
rabbitmq_password = s13kr3t
deployment_role_key = dummy
mandrill_api_key = dummy
mailchimp_api_key = dummy-us4
camo_key = dummy
email_password = dummy
s3_key = dummy
s3_secret_key= dummy
google_oauth2_client_secret = dummy
dev_google_oauth2_client_secret = dummy

View File

@ -6,11 +6,6 @@ from base64 import b64decode
config_file = ConfigParser.RawConfigParser()
config_file.read("/etc/zulip/zulip.conf")
secrets_file = ConfigParser.RawConfigParser()
secrets_file.read("/etc/zulip/zulip-secrets.conf")
getsecret = lambda x: secrets_file.get('secrets', x)
# Whether we're running in a production environment. Note that DEPLOYED does
# **not** mean hosted by us; customer sites are DEPLOYED and ENTERPRISE
# and as such should not for example assume they are the main Zulip site.
@ -20,6 +15,14 @@ TESTING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'te
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")
getsecret = lambda x: secrets_file.get('secrets', x)
# Make this unique, and don't share it with anybody.
SECRET_KEY = getsecret("secret_key") if DEPLOYED else "foobar"