Skip to content

Commit 54c6955

Browse files
Harshg999sreenaths
authored andcommitted
Add docstring for dynamic default and slack token get() changes
1 parent 6fecd9e commit 54c6955

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

desktop/core/src/desktop/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,19 @@ def is_https_enabled():
131131
return bool(SSL_CERTIFICATE.get() and SSL_PRIVATE_KEY.get())
132132

133133
def get_slack_client_id():
134+
"""Returns Slack Client ID if set as environment variable else None"""
134135
return os.environ.get('SLACK_CLIENT_ID')
135136

136137
def get_slack_client_secret():
138+
"""Returns Slack Client Secret if set as environment variable else None"""
137139
return os.environ.get('SLACK_CLIENT_SECRET')
138140

139141
def get_slack_verification_token():
142+
"""Returns Slack Verification Token if set as environment variable else None"""
140143
return os.environ.get('SLACK_VERIFICATION_TOKEN')
141144

142145
def get_slack_bot_user_token():
146+
"""Returns Slack Bot User Token if set as environment variable else None"""
143147
return os.environ.get('SLACK_BOT_USER_TOKEN')
144148

145149

desktop/core/src/desktop/lib/botserver/views.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@
2222
from django.shortcuts import render
2323
from django.http import HttpResponse
2424
from desktop.lib.django_util import login_notrequired, JsonResponse
25+
from desktop import conf
2526
from django.views.decorators.csrf import csrf_exempt
2627

2728
from django.conf import settings
2829
from slack_sdk import WebClient
2930

3031
LOG = logging.getLogger(__name__)
3132

32-
SLACK_VERIFICATION_TOKEN = getattr(settings, 'SLACK_VERIFICATION_TOKEN', None)
33-
SLACK_BOT_USER_TOKEN = getattr(settings, 'SLACK_BOT_USER_TOKEN', None)
33+
SLACK_VERIFICATION_TOKEN = conf.SLACK.SLACK_VERIFICATION_TOKEN.get()
34+
SLACK_BOT_USER_TOKEN = conf.SLACK.SLACK_BOT_USER_TOKEN.get()
3435

3536

3637
slack_client = WebClient(token=SLACK_BOT_USER_TOKEN)

desktop/core/src/desktop/settings.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -819,12 +819,3 @@ def tracer():
819819
except ValueError:
820820
from desktop.monkey_patches import monkey_patch_md5
821821
monkey_patch_md5(MODULES_TO_PATCH)
822-
823-
################################################################
824-
# SLACK API Configurations
825-
################################################################
826-
827-
SLACK_CLIENT_ID = desktop.conf.SLACK.SLACK_CLIENT_ID.get()
828-
SLACK_CLIENT_SECRET = desktop.conf.SLACK.SLACK_CLIENT_SECRET.get()
829-
SLACK_VERIFICATION_TOKEN = desktop.conf.SLACK.SLACK_VERIFICATION_TOKEN.get()
830-
SLACK_BOT_USER_TOKEN = desktop.conf.SLACK.SLACK_BOT_USER_TOKEN.get()

0 commit comments

Comments
 (0)