From 4d977e9d1e4733bb73d2ce037c4482a1f1dd6507 Mon Sep 17 00:00:00 2001 From: guohelu <19503896967@163.com> Date: Wed, 20 Nov 2024 15:18:12 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E9=97=AE=E9=A2=98=20#7545?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/default.py | 2 ++ env.py | 1 + gcloud/shortcuts/message/send_msg.py | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/default.py b/config/default.py index 6b50c6683..a0bfe29cd 100644 --- a/config/default.py +++ b/config/default.py @@ -12,6 +12,7 @@ """ import datetime import importlib +import os import sys from urllib.parse import urlparse @@ -748,6 +749,7 @@ def monitor_report_config(): # 蓝鲸插件授权过滤 APP PLUGIN_DISTRIBUTOR_NAME = env.PLUGIN_DISTRIBUTOR_NAME or APP_CODE +PLUGIN_DISTRIBUTOR_SELECT = env.PLUGIN_DISTRIBUTOR_SELECT or os.getenv("APP_TOKEN") # IAM APIGW 地址 BK_IAM_APIGW_HOST = env.BK_IAM_APIGW_HOST diff --git a/env.py b/env.py index a6553f09a..379952f65 100644 --- a/env.py +++ b/env.py @@ -43,6 +43,7 @@ # 蓝鲸插件授权过滤 APP PLUGIN_DISTRIBUTOR_NAME = os.getenv("PLUGIN_DISTRIBUTOR_NAME", os.getenv("BKAPP_PLUGIN_DISTRIBUTOR_NAME")) +PLUGIN_DISTRIBUTOR_SELECT = os.getenv("PLUGIN_DISTRIBUTOR_SELECT", os.getenv("BKAPP_PLUGIN_DISTRIBUTOR_SELECT")) # IAM APIGW 地址 BK_IAM_APIGW_HOST = os.getenv("BK_IAM_APIGW_HOST") diff --git a/gcloud/shortcuts/message/send_msg.py b/gcloud/shortcuts/message/send_msg.py index f462019b0..40a0153bc 100644 --- a/gcloud/shortcuts/message/send_msg.py +++ b/gcloud/shortcuts/message/send_msg.py @@ -67,7 +67,7 @@ def send(self, executor, notify_type, notify_info, receivers, title, content, em return True def send_bkchat(self, notify, content): - params = {"bk_app_code": settings.APP_CODE, "bk_app_secret": settings.SECRET_KEY} + params = {"bk_app_code": settings.PLUGIN_DISTRIBUTOR_NAME, "bk_app_secret": settings.PLUGIN_DISTRIBUTOR_SELECT} data = { "im": "WEWORK", From ee5dd7dd23225ccfb072e28c950647cece2288ec Mon Sep 17 00:00:00 2001 From: guohelu <19503896967@163.com> Date: Wed, 20 Nov 2024 15:42:34 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=20#7545?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/default.py | 4 +++- env.py | 4 +++- gcloud/shortcuts/message/send_msg.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/default.py b/config/default.py index a0bfe29cd..5bc426085 100644 --- a/config/default.py +++ b/config/default.py @@ -749,7 +749,6 @@ def monitor_report_config(): # 蓝鲸插件授权过滤 APP PLUGIN_DISTRIBUTOR_NAME = env.PLUGIN_DISTRIBUTOR_NAME or APP_CODE -PLUGIN_DISTRIBUTOR_SELECT = env.PLUGIN_DISTRIBUTOR_SELECT or os.getenv("APP_TOKEN") # IAM APIGW 地址 BK_IAM_APIGW_HOST = env.BK_IAM_APIGW_HOST @@ -890,3 +889,6 @@ def check_engine_admin_permission(request, *args, **kwargs): ENABLE_BK_CHAT_CHANNEL = env.ENABLE_BK_CHAT_CHANNEL # bk_chat路由 BK_CHAT_API_ENTRY = env.BK_CHAT_API_ENTRY +# bk_chat通知渠道过滤app +BK_CHAT_APP_CODE = env.BK_CHAT_APP_CODE +BK_CHAT_APP_SECRET_KEY = env.BK_CHAT_APP_SECRET_KEY diff --git a/env.py b/env.py index 379952f65..612022efd 100644 --- a/env.py +++ b/env.py @@ -43,7 +43,6 @@ # 蓝鲸插件授权过滤 APP PLUGIN_DISTRIBUTOR_NAME = os.getenv("PLUGIN_DISTRIBUTOR_NAME", os.getenv("BKAPP_PLUGIN_DISTRIBUTOR_NAME")) -PLUGIN_DISTRIBUTOR_SELECT = os.getenv("PLUGIN_DISTRIBUTOR_SELECT", os.getenv("BKAPP_PLUGIN_DISTRIBUTOR_SELECT")) # IAM APIGW 地址 BK_IAM_APIGW_HOST = os.getenv("BK_IAM_APIGW_HOST") @@ -159,3 +158,6 @@ ENABLE_BK_CHAT_CHANNEL = False if os.getenv("BKAPP_ENABLE_BK_CHAT_CHANNEL") is None else True # bk_chat通知路由 BK_CHAT_API_ENTRY = os.getenv("BK_CHAT_API_ENTRY", "") +# bk_chat通知渠道过滤app +BK_CHAT_APP_CODE = os.getenv("BK_CHAT_APP_CODE", APP_CODE) +BK_CHAT_APP_SECRET_KEY = os.getenv("BK_CHAT_APP_SECRET_KEY", os.getenv("APP_TOKEN")) diff --git a/gcloud/shortcuts/message/send_msg.py b/gcloud/shortcuts/message/send_msg.py index 40a0153bc..b09f2b6ad 100644 --- a/gcloud/shortcuts/message/send_msg.py +++ b/gcloud/shortcuts/message/send_msg.py @@ -67,7 +67,7 @@ def send(self, executor, notify_type, notify_info, receivers, title, content, em return True def send_bkchat(self, notify, content): - params = {"bk_app_code": settings.PLUGIN_DISTRIBUTOR_NAME, "bk_app_secret": settings.PLUGIN_DISTRIBUTOR_SELECT} + params = {"bk_app_code": settings.BK_CHAT_APP_CODE, "bk_app_secret": settings.BK_CHAT_APP_SECRET_KEY} data = { "im": "WEWORK", From 19c793e8dcc30e61e917257c90d96b8dbc64485b Mon Sep 17 00:00:00 2001 From: guohelu <19503896967@163.com> Date: Wed, 20 Nov 2024 15:44:57 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E5=AF=BC=E5=8C=85=20#7545?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.py b/config/default.py index 5bc426085..6d73539e8 100644 --- a/config/default.py +++ b/config/default.py @@ -12,7 +12,7 @@ """ import datetime import importlib -import os + import sys from urllib.parse import urlparse From e15e0439c10a8ce8cb64e7a0c1a5efe9e8a96358 Mon Sep 17 00:00:00 2001 From: guohelu <19503896967@163.com> Date: Wed, 20 Nov 2024 16:12:14 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E8=AF=BB=E5=8F=96=20#7545?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/default.py | 1 - env.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/config/default.py b/config/default.py index 6d73539e8..cfde7dba3 100644 --- a/config/default.py +++ b/config/default.py @@ -12,7 +12,6 @@ """ import datetime import importlib - import sys from urllib.parse import urlparse diff --git a/env.py b/env.py index 612022efd..30a10047d 100644 --- a/env.py +++ b/env.py @@ -159,5 +159,5 @@ # bk_chat通知路由 BK_CHAT_API_ENTRY = os.getenv("BK_CHAT_API_ENTRY", "") # bk_chat通知渠道过滤app -BK_CHAT_APP_CODE = os.getenv("BK_CHAT_APP_CODE", APP_CODE) -BK_CHAT_APP_SECRET_KEY = os.getenv("BK_CHAT_APP_SECRET_KEY", os.getenv("APP_TOKEN")) +BK_CHAT_APP_CODE = os.getenv("BK_CHAT_APP_CODE", os.getenv("BKPAAS_APP_ID")) +BK_CHAT_APP_SECRET_KEY = os.getenv("BK_CHAT_APP_SECRET_KEY", os.getenv("BKPAAS_APP_SECRET"))