mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-07-09 23:55:34 +00:00
build: validate CFG_SRC_URL and simplify CFG_RELEASE handling
This commit is contained in:
parent
fa14844d0d
commit
fac146e859
6 changed files with 32 additions and 12 deletions
|
@ -16,7 +16,10 @@ use reqwest::Url;
|
|||
use rusqlite::{named_params, prepare_and_bind, Connection};
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
const USER_AGENT: &str = concat!("blahctl/", env!("CARGO_PKG_VERSION"));
|
||||
const USER_AGENT: fn() -> String = || match option_env!("CFG_RELEASE") {
|
||||
None => concat!("blahctl/", env!("CARGO_PKG_VERSION")).into(),
|
||||
Some(vers) => format!("blahctl/{vers}"),
|
||||
};
|
||||
|
||||
/// Control or manage Blah Chat Server.
|
||||
#[derive(Debug, clap::Parser)]
|
||||
|
@ -337,7 +340,7 @@ fn build_rt() -> Result<Runtime> {
|
|||
|
||||
fn build_client() -> Result<reqwest::Client> {
|
||||
reqwest::Client::builder()
|
||||
.user_agent(USER_AGENT)
|
||||
.user_agent(USER_AGENT())
|
||||
.redirect(reqwest::redirect::Policy::none())
|
||||
.build()
|
||||
.context("failed to build HTTP client")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue