feat: do not send notification when notify token is empty
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -541,7 +541,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "keeprunningd"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"argparse",
|
||||
"chrono",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"check_inverval_secs": 1,
|
||||
"show_debug_output": true,
|
||||
"notify_token": "------------",
|
||||
"notify_token": "",
|
||||
"lock_file": ".keeprunningd.lock",
|
||||
"items": [{
|
||||
"grep_tokens": ["java", "app"],
|
||||
|
||||
@@ -170,6 +170,10 @@ fn keep_runningd(keep_running_config: Arc<KeepRunningConfig>) {
|
||||
}
|
||||
|
||||
async fn send_notify(notify_token: &str, text: &str) {
|
||||
if notify_token.is_empty() {
|
||||
info!("Notify token is empty, do not send DingTalk notification");
|
||||
return;
|
||||
}
|
||||
match DingTalk::from_token(¬ify_token) {
|
||||
Err(err) => error!("Prepare DingTalk error: {}", err),
|
||||
Ok(dt) => if let Err(err) = dt.send_text(text).await {
|
||||
|
||||
Reference in New Issue
Block a user