Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 触发器企业微信机器人通知webhook通知失败的问题 #1461

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import base64
import datetime
import importlib
import os
from urllib.parse import urljoin, urlparse

from blueapps.conf.default_settings import * # noqa
Expand Down Expand Up @@ -971,3 +972,5 @@ def redirect_func(request):
PIPELINE_ENGINE_ADMIN_API_PERMISSION = (
"itsm.helper.permissions.check_permission_success"
)

QW_WEB_HOOK_URL = os.getenv("BKAPP_QW_WEB_HOOK_URL", "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里需要有默认值,配置正确的hook 地址
-- 此部分主要是基于部署考虑

5 changes: 3 additions & 2 deletions itsm/component/utils/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@

from common.log import logger
from common.sub_string import sub_string
from django.conf import settings


WEB_HOOK_URL = "http://in.qyapi.weixin.qq.com/cgi-bin/webhook/send?key={}"
QW_WEB_HOOK_URL = settings.QW_WEB_HOOK_URL


class Announcement(Thread):
Expand Down Expand Up @@ -63,7 +64,7 @@ def run(self):
if self.chat_ids is not None:
data["chatid"] = self.chat_ids
resp = session.post(
url=WEB_HOOK_URL.format(self.web_hook_id),
url=QW_WEB_HOOK_URL.format(self.web_hook_id),
data=json.dumps(data),
verify=False,
)
Expand Down