Skip to content

Commit

Permalink
-i to override the default server file used by the deploy file
Browse files Browse the repository at this point in the history
  • Loading branch information
flawiddsouza committed Nov 9, 2024
1 parent fa91eef commit d493162
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,22 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.help("Set additional variables as key=value, JSON, or @file")
.num_args(1),
)
.arg(
Arg::new("server_file")
.short('i')
.long("inventory")
.value_name("FILE")
.help("The server configuration YAML file")
.num_args(1),
)
.get_matches();

let deploy_file = matches.get_one::<String>("deploy_file").unwrap();
let extra_vars = matches.get_one::<String>("extra_vars").map(|s| s.as_str());
let default_server_file = "servers.yml".to_string();
let server_file = matches.get_one::<String>("server_file").unwrap_or(&default_server_file);

let server_config: ServerConfig = read_yaml("servers.yml")?;
let server_config: ServerConfig = read_yaml(server_file)?;
let deployment_docs: Vec<Vec<Deployment>> = read_yaml_multi(deploy_file)?;
let deployments = deployment_docs.into_iter().flatten().collect::<Vec<_>>();

Expand Down

0 comments on commit d493162

Please sign in to comment.