mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-26 19:22:29 +00:00
feat: allow specifying config path via command flag
This commit is contained in:
parent
60a2f2d011
commit
9a88386ddf
@ -22,6 +22,10 @@ fn version() -> String {
|
||||
pub struct Args {
|
||||
#[command(subcommand)]
|
||||
pub command: Option<Commands>,
|
||||
|
||||
/// Path to the config file
|
||||
#[arg(short, long, value_name = "PATH")]
|
||||
pub config: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
|
@ -55,10 +55,10 @@ static GLOBAL: Jemalloc = Jemalloc;
|
||||
async fn main() {
|
||||
let cli = clap::parse();
|
||||
|
||||
let path =
|
||||
let path = cli.config.unwrap_or_else(|| {
|
||||
Env::var("CONDUIT_CONFIG")
|
||||
.expect("The config path must either be set via the -c/--config flag or the CONDUIT_CONFIG env var. Example: /etc/conduit.toml")
|
||||
;
|
||||
});
|
||||
|
||||
match cli.command {
|
||||
Some(Commands::GenerateConfig) => {
|
||||
|
Loading…
Reference in New Issue
Block a user