From ae08cd5ff7429b2d5fd5161f8ca18e52f8fb4d1d Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 14 Mar 2025 13:18:39 +0100 Subject: cgi: add env map option; close #5 --- src/modules/cgi.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/cgi.rs b/src/modules/cgi.rs index 2af8537..7d58539 100644 --- a/src/modules/cgi.rs +++ b/src/modules/cgi.rs @@ -11,7 +11,8 @@ use hyper::{ use serde::Deserialize; use serde_yml::Value; use std::{ - future::Future, io::ErrorKind, path::PathBuf, pin::Pin, process::Stdio, str::FromStr, sync::Arc, + collections::BTreeMap, future::Future, io::ErrorKind, path::PathBuf, pin::Pin, process::Stdio, + str::FromStr, sync::Arc, }; use tokio::{ io::{copy, AsyncBufReadExt, BufReader, BufWriter}, @@ -26,8 +27,11 @@ pub struct CgiKind; #[derive(Deserialize)] struct CgiConfig { bin: PathBuf, + #[serde(default)] + env: BTreeMap, user: Option, } + struct Cgi { config: CgiConfig, user: Option, @@ -74,7 +78,7 @@ impl Node for Cgi { command.uid(uid); } - // command.env("AUTH_TYPE", ); + command.envs(&self.config.env); command.env( "CONTENT_LENGTH", request -- cgit v1.2.3-70-g09d2