parent
22ff55c667
commit
d88b77fb02
@ -25,16 +25,22 @@ use route96::webhook::Webhook;
|
|||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[command(version, about)]
|
#[command(version, about)]
|
||||||
struct Args {
|
struct Args {
|
||||||
|
#[arg(long)]
|
||||||
|
pub config: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rocket::main]
|
#[rocket::main]
|
||||||
async fn main() -> Result<(), Error> {
|
async fn main() -> Result<(), Error> {
|
||||||
pretty_env_logger::init();
|
pretty_env_logger::init();
|
||||||
|
|
||||||
let _args: Args = Args::parse();
|
let args: Args = Args::parse();
|
||||||
|
|
||||||
let builder = Config::builder()
|
let builder = Config::builder()
|
||||||
.add_source(config::File::with_name("config.toml"))
|
.add_source(config::File::with_name(if let Some(ref c) = args.config {
|
||||||
|
c.as_str()
|
||||||
|
} else {
|
||||||
|
"config.toml"
|
||||||
|
}))
|
||||||
.add_source(config::Environment::with_prefix("APP"))
|
.add_source(config::Environment::with_prefix("APP"))
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user