2
0

I think fixed stuff up

This commit is contained in:
Matt Robenolt 2019-04-19 12:02:55 -07:00
parent d469fb8135
commit 82aa12b886

View File

@ -49,6 +49,7 @@
# BITBUCKET_CONSUMER_KEY
# BITBUCKET_CONSUMER_SECRET
from sentry.conf.server import * # NOQA
from sentry.utils.types import Bool, Int
import os
import os.path
@ -276,12 +277,13 @@ SENTRY_WEB_OPTIONS = {
ENV_CONFIG_MAPPING = {
'SENTRY_EMAIL_PASSWORD': 'mail.password',
'SENTRY_EMAIL_USER': 'mail.username',
'SENTRY_EMAIL_PORT': ('mail.port', int),
'SENTRY_EMAIL_USE_TLS': ('mail.use-tls', bool),
'SENTRY_EMAIL_PORT': ('mail.port', Int),
'SENTRY_EMAIL_USE_TLS': ('mail.use-tls', Bool),
'SENTRY_EMAIL_HOST': 'mail.host',
'SENTRY_SERVER_EMAIL': 'mail.from',
'SENTRY_ENABLE_EMAIL_REPLIES': 'mail.enable-replies',
'SENTRY_SMTP_HOSTNAME': 'mail.reply-hostname',
'SENTRY_SECRET_KEY': 'system.secret-key',
# If you're using mailgun for inbound mail, set your API key and configure a
# route to forward to /api/hooks/mailgun/inbound/
@ -299,8 +301,6 @@ ENV_CONFIG_MAPPING = {
'VSTS_CLIENT_ID': 'vsts.client-id',
'VSTS_CLIENT_SECRET': 'vsts.client-secret',
'SECRET_KEY': 'system.secret-key',
}
@ -309,13 +309,12 @@ def bind_env_config(config=SENTRY_OPTIONS, mapping=ENV_CONFIG_MAPPING):
Automatically bind SENTRY_OPTIONS from a set of environment variables.
"""
for env_var, item in six.iteritems(mapping):
value = env(env_var)
if value is None:
try:
value = os.environ[env_var]
except KeyError:
continue
if isinstance(item, tuple):
opt_key, type_ = item
# only coerce the value if its not falsey (e.g. '')
if value:
value = type_(value)
else:
opt_key = item