mirror of
https://github.com/veops/cmdb.git
synced 2025-08-07 00:02:46 +08:00
feat: get messenger url from common setting
This commit is contained in:
@@ -8,6 +8,7 @@ from flask import current_app
|
||||
from jinja2 import Template
|
||||
from markdownify import markdownify as md
|
||||
|
||||
from api.lib.common_setting.notice_config import NoticeConfigCRUD
|
||||
from api.lib.mail import send_mail
|
||||
|
||||
|
||||
@@ -41,7 +42,14 @@ def _request_messenger(subject, body, tos, sender, payload):
|
||||
|
||||
params['content'] = json.dumps(dict(content=content))
|
||||
|
||||
resp = requests.post(current_app.config.get('MESSENGER_URL'), json=params)
|
||||
url = current_app.config.get('MESSENGER_URL') or NoticeConfigCRUD.get_messenger_url()
|
||||
if not url:
|
||||
raise Exception("no messenger url")
|
||||
|
||||
if not url.endswith("message"):
|
||||
url = "{}/v1/message".format(url)
|
||||
|
||||
resp = requests.post(url, json=params)
|
||||
if resp.status_code != 200:
|
||||
raise Exception(resp.text)
|
||||
|
||||
|
@@ -97,4 +97,3 @@ BOOL_TRUE = ['true', 'TRUE', 'True', True, '1', 1, "Yes", "YES", "yes", 'Y', 'y'
|
||||
|
||||
# # messenger
|
||||
USE_MESSENGER = True
|
||||
MESSENGER_URL = "http://{messenger_url}/v1/message"
|
||||
|
@@ -346,11 +346,6 @@ export default {
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
async getNoticeConfigAppBot() {
|
||||
await getNoticeConfigAppBot().then((res) => {
|
||||
this.appBot = res
|
||||
})
|
||||
},
|
||||
async getNoticeConfigAppBot() {
|
||||
await getNoticeConfigAppBot().then((res) => {
|
||||
this.appBot = res
|
||||
|
Reference in New Issue
Block a user