diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index e0f20a1..27d3820 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,9 +25,13 @@ fn main() { let conf = Confindent::from_file(conf_path).expect("failed to open conf"); let script = conf.child("Script").expect("no 'Script' key in conf"); + let environment = script.child("Environment"); + let env = environment + .map(|e| e.values().map(|v| (v.key_owned(), v.value_owned().unwrap())).collect()); + let settings = Settings { script_filename: script.value_owned().expect("'Script' key has no value'"), - env: vec![], + env: env.unwrap_or_default(), }; let rt = Runtime::new().unwrap(); @@ -92,9 +96,17 @@ impl Svc { if hname.to_ascii_lowercase() == "user-agent" { println!("USER_AGENT: {hvalue}"); } + + if hname.to_ascii_lowercase() == "host" { + println!("HOST: {hvalue}"); + } } } + for (key, value) in &settings.env { + cmd.env(key.to_ascii_uppercase(), value); + } + /*if content_length > 0 { cmd.env("CONTENT_LENGTH", content_length.to_string()); }*/ |