Add explicit environment propagation
This commit is contained in:
@@ -34,6 +34,8 @@ pub struct ServerConfig {
|
||||
pub allow_remote_forwarding: bool,
|
||||
#[serde(default)]
|
||||
pub allow_agent_forwarding: bool,
|
||||
#[serde(default = "default_accept_env")]
|
||||
pub accept_env: Vec<String>,
|
||||
}
|
||||
|
||||
impl Default for ServerConfig {
|
||||
@@ -60,6 +62,7 @@ impl Default for ServerConfig {
|
||||
allow_tcp_forwarding: true,
|
||||
allow_remote_forwarding: false,
|
||||
allow_agent_forwarding: false,
|
||||
accept_env: default_accept_env(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,6 +97,10 @@ pub struct ClientConfig {
|
||||
pub use_ssh_agent: bool,
|
||||
#[serde(default)]
|
||||
pub forward_agent: bool,
|
||||
#[serde(default = "default_send_env")]
|
||||
pub send_env: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub set_env: HashMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
@@ -104,6 +111,10 @@ pub struct HostConfig {
|
||||
pub ssh_port: Option<u16>,
|
||||
pub default_command: Option<String>,
|
||||
pub predict: Option<bool>,
|
||||
#[serde(default)]
|
||||
pub send_env: Option<Vec<String>>,
|
||||
#[serde(default)]
|
||||
pub set_env: HashMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
@@ -135,6 +146,8 @@ impl Default for ClientConfig {
|
||||
identity_files: default_identity_files(),
|
||||
use_ssh_agent: true,
|
||||
forward_agent: false,
|
||||
send_env: default_send_env(),
|
||||
set_env: HashMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,6 +187,19 @@ fn default_identity_files() -> Vec<String> {
|
||||
vec!["~/.ssh/id_ed25519".to_string()]
|
||||
}
|
||||
|
||||
fn default_send_env() -> Vec<String> {
|
||||
vec![
|
||||
"LANG".to_string(),
|
||||
"LC_*".to_string(),
|
||||
"TERM".to_string(),
|
||||
"COLORTERM".to_string(),
|
||||
]
|
||||
}
|
||||
|
||||
fn default_accept_env() -> Vec<String> {
|
||||
default_send_env()
|
||||
}
|
||||
|
||||
pub fn load_server_config(path: Option<PathBuf>) -> Result<ServerConfig> {
|
||||
let path = path.unwrap_or_else(|| expand_tilde("~/.config/dosh/server.toml"));
|
||||
if !path.exists() {
|
||||
|
||||
Reference in New Issue
Block a user