feat: allow specifying config path via command flag
This commit is contained in:
parent
60a2f2d011
commit
9a88386ddf
2 changed files with 6 additions and 2 deletions
|
@ -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 a new issue