Skip to content

Commit

Permalink
Define telegram_webhook URL only when required parameters are satisfied.
Browse files Browse the repository at this point in the history
  • Loading branch information
Edu4rdSHL committed Oct 30, 2019
1 parent 1b5e2a3 commit 486a287
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/errors.rs
Expand Up @@ -54,8 +54,11 @@ pub fn check_monitoring_parameters(args: &mut args::Args) -> Result<()> {
} else if !args.telegram_bot_token.is_empty() && args.telegram_chat_id.is_empty() {
eprintln!("You have configured the findomain_telegrambot_token variable but not the findomain_telegrambot_chat_id variable, it's required. See https://git.io/JeZQW for more information, exiting.");
std::process::exit(1)
} else if args.telegram_bot_token.is_empty() && args.telegram_chat_id.is_empty() {
args.telegram_webhook = String::new()
} else if !args.telegram_bot_token.is_empty() && !args.telegram_chat_id.is_empty() {
args.telegram_webhook = format!(
"https://api.telegram.org/bot{}/sendMessage",
get_vars::get_auth_token("telegram")
)
}
Ok(())
}

0 comments on commit 486a287

Please sign in to comment.