Add base configuration (#1)
All checks were successful
continuous-integration/drone Build is passing

Reviewed-on: #1
This commit is contained in:
2023-04-27 15:51:07 +00:00
parent af7b48b9b7
commit 7a45fe1c0c
4 changed files with 500 additions and 0 deletions

View File

@ -1,3 +1,50 @@
use clap::Parser;
/// Basic OpenID test client
#[derive(Parser, Debug)]
struct AppConfig {
/// Listen URL
#[arg(short, long, env, default_value = "0.0.0.0:7510")]
listen_addr: String,
/// Public URL, the URL where this service is accessible, without the trailing slash
#[arg(short, long, env, default_value = "http://localhost:7510")]
public_url: String,
/// URL where the OpenID configuration can be found
#[arg(short, long, env)]
configuration_url: String,
/// OpenID client ID
#[arg(long, env)]
client_id: String,
/// OpenID client secret
#[arg(long, env)]
client_secret: String,
}
lazy_static::lazy_static! {
static ref CONF: AppConfig = {
AppConfig::parse()
};
}
fn main() {
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
log::info!("Will listen on {}", CONF.listen_addr);
println!("Hello, world!");
}
#[cfg(test)]
mod test {
use crate::AppConfig;
#[test]
fn verify_cli() {
use clap::CommandFactory;
AppConfig::command().debug_assert();
}
}