Compare commits
No commits in common. "117a0b4701ff2df76840b6d23a153b3dd4f7ea12" and "6f2d410e5e7e983b133e4a3081003cfab03e4a3d" have entirely different histories.
117a0b4701
...
6f2d410e5e
3 changed files with 5 additions and 7 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -183,7 +183,7 @@ checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "secrets-file-builder"
|
name = "secrets-file-builder"
|
||||||
version = "0.2.2"
|
version = "0.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"handlebars",
|
"handlebars",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "secrets-file-builder"
|
name = "secrets-file-builder"
|
||||||
version = "0.2.2"
|
version = "0.2.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["networkException <git@nwex.de>"]
|
authors = ["networkException <git@nwex.de>"]
|
||||||
license = "BSD-2-Clause"
|
license = "BSD-2-Clause"
|
||||||
|
|
|
@ -14,8 +14,7 @@ fn main() -> Result<()> {
|
||||||
let path_to_contents = env::args().nth(1).expect("The first argument to be present.");
|
let path_to_contents = env::args().nth(1).expect("The first argument to be present.");
|
||||||
let output_path = env::args().nth(2).expect("The second argument to be present.");
|
let output_path = env::args().nth(2).expect("The second argument to be present.");
|
||||||
|
|
||||||
let contents = fs::read_to_string(&path_to_contents)
|
let contents = fs::read_to_string(path_to_contents).expect("To be able to read the contents file at the path '{path_to_contents}' passed as the first argument.");
|
||||||
.expect(format!("To be able to read the contents file at the path '{path_to_contents}' passed as the first argument.").as_str());
|
|
||||||
|
|
||||||
let secret_inputs = env::vars().filter(|(key, _)| key.starts_with("SECRET_"));
|
let secret_inputs = env::vars().filter(|(key, _)| key.starts_with("SECRET_"));
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ fn main() -> Result<()> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let secret_value = fs::read_to_string(path_to_secret)
|
let secret_value = fs::read_to_string(path_to_secret)
|
||||||
.expect(format!("To be able to read in secret '{secret_key}' from path '{path_to_secret}'").as_str());
|
.expect("To be able to read in secret '{secret_key}' from path '{path_to_secret}'");
|
||||||
|
|
||||||
println!("Registering secret '{secret_key}' from '{path_to_secret}'.");
|
println!("Registering secret '{secret_key}' from '{path_to_secret}'.");
|
||||||
|
|
||||||
|
@ -74,8 +73,7 @@ fn main() -> Result<()> {
|
||||||
|
|
||||||
let output = handlebars.render_template(contents.as_str(), &Value::Object(data_map))?;
|
let output = handlebars.render_template(contents.as_str(), &Value::Object(data_map))?;
|
||||||
|
|
||||||
fs::write(&output_path, output)
|
fs::write(output_path, output).expect("To be able to write to {output_path}");
|
||||||
.expect(format!("To be able to write to {output_path}").as_str());
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue