forked from github/plane
chore: added SKIP_ENV_VAR
This commit is contained in:
parent
279044e895
commit
1fd7372c18
@ -29,20 +29,17 @@ def get_configuration_value(keys):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
environment_list.append(key.get("default"))
|
environment_list.append(key.get("default"))
|
||||||
|
else:
|
||||||
|
# Get the configuration from os
|
||||||
|
for key in keys:
|
||||||
|
environment_list.append(os.environ.get(key.get("key"), key.get("default")))
|
||||||
|
|
||||||
return tuple(environment_list)
|
return tuple(environment_list)
|
||||||
|
|
||||||
|
|
||||||
def get_email_configuration():
|
def get_email_configuration():
|
||||||
if settings.SKIP_ENV_VAR:
|
return (
|
||||||
(
|
get_configuration_value(
|
||||||
EMAIL_HOST_USER,
|
|
||||||
EMAIL_HOST_PASSWORD,
|
|
||||||
EMAIL_HOST,
|
|
||||||
EMAIL_FROM,
|
|
||||||
EMAIL_USE_TLS,
|
|
||||||
EMAIL_PORT,
|
|
||||||
) = get_configuration_value(
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"key": "EMAIL_HOST_USER",
|
"key": "EMAIL_HOST_USER",
|
||||||
@ -58,7 +55,7 @@ def get_email_configuration():
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "EMAIL_FROM",
|
"key": "EMAIL_FROM",
|
||||||
"default": os.environ.get("EMAIL_FROM", None),
|
"default": os.environ.get("EMAIL_FROM", "Team Plane <team@mailer.plane.so>"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "EMAIL_USE_TLS",
|
"key": "EMAIL_USE_TLS",
|
||||||
@ -70,29 +67,5 @@ def get_email_configuration():
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return (
|
|
||||||
EMAIL_HOST,
|
|
||||||
EMAIL_HOST_USER,
|
|
||||||
EMAIL_HOST_PASSWORD,
|
|
||||||
EMAIL_PORT,
|
|
||||||
EMAIL_USE_TLS,
|
|
||||||
EMAIL_FROM,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
|
||||||
# Get email configuration directly from os
|
|
||||||
EMAIL_HOST = os.environ.get("EMAIL_HOST")
|
|
||||||
EMAIL_HOST_USER = os.environ.get("EMAIL_HOST_USER")
|
|
||||||
EMAIL_HOST_PASSWORD = os.environ.get("EMAIL_HOST_PASSWORD")
|
|
||||||
EMAIL_PORT = os.environ.get("EMAIL_PORT", 587)
|
|
||||||
EMAIL_USE_TLS = os.environ.get("EMAIL_USE_TLS", "1")
|
|
||||||
EMAIL_FROM = os.environ.get("EMAIL_FROM", "Team Plane <team@mailer.plane.so>")
|
|
||||||
|
|
||||||
return (
|
|
||||||
EMAIL_HOST,
|
|
||||||
EMAIL_HOST_USER,
|
|
||||||
EMAIL_HOST_PASSWORD,
|
|
||||||
EMAIL_PORT,
|
|
||||||
EMAIL_USE_TLS,
|
|
||||||
EMAIL_FROM,
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user