mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
Make get_secret return None instead of an exception if the secret isn't defined.
Remove empty key generation from generate_enterprise_secrets, since get_secret ignores missing keys now. (imported from commit 32d61e3058f0d41bfb4b17775e581a3c84540fe7)
This commit is contained in:
@@ -16,9 +16,6 @@ CAMO_CONFIG_FILENAME = '/etc/default/camo'
|
|||||||
AUTOGENERATED_SETTINGS = ['shared_secret', 'avatar_salt', 'rabbitmq_password', 'local_database_password',
|
AUTOGENERATED_SETTINGS = ['shared_secret', 'avatar_salt', 'rabbitmq_password', 'local_database_password',
|
||||||
'initial_password_salt']
|
'initial_password_salt']
|
||||||
|
|
||||||
EMPTY_SETTINGS = ['deployment_role_key', 'mandrill_api_key', 'mailchimp_api_key', 'email_password', 's3_key', 's3_secret_key',
|
|
||||||
'google_oauth2_client_secret', 'dev_google_oauth2_client_secret']
|
|
||||||
|
|
||||||
def generate_camo_config_file(camo_key):
|
def generate_camo_config_file(camo_key):
|
||||||
camo_config = """ENABLED=yes
|
camo_config = """ENABLED=yes
|
||||||
PORT=9292
|
PORT=9292
|
||||||
@@ -54,9 +51,6 @@ def generate_secrets(development=False):
|
|||||||
# Write the Camo config file directly
|
# Write the Camo config file directly
|
||||||
generate_camo_config_file(camo_key)
|
generate_camo_config_file(camo_key)
|
||||||
|
|
||||||
for name in EMPTY_SETTINGS:
|
|
||||||
lines.append(config_line(name, ''))
|
|
||||||
|
|
||||||
out = open(OUTPUT_SETTINGS_FILENAME, 'w')
|
out = open(OUTPUT_SETTINGS_FILENAME, 'w')
|
||||||
out.write("".join(lines))
|
out.write("".join(lines))
|
||||||
out.close()
|
out.close()
|
||||||
|
|||||||
@@ -21,7 +21,10 @@ if DEPLOYED:
|
|||||||
else:
|
else:
|
||||||
secrets_file.read("zproject/dev-secrets.conf")
|
secrets_file.read("zproject/dev-secrets.conf")
|
||||||
|
|
||||||
get_secret = lambda x: secrets_file.get('secrets', x)
|
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")
|
MAILCHIMP_API_KEY = get_secret("mailchimp_api_key")
|
||||||
ZULIP_FRIENDS_LIST_ID = '84b2f3da6b'
|
ZULIP_FRIENDS_LIST_ID = '84b2f3da6b'
|
||||||
|
|||||||
Reference in New Issue
Block a user