()
| 19 | |
| 20 | const DEFAULT_SYSTEM_CONFIG_DIR: &str = "/etc/openshell"; |
| 21 | fn system_config_dir_override() -> Option<PathBuf> { |
| 22 | let path = PathBuf::from(std::env::var_os(SYSTEM_GATEWAY_DIR_ENV)?); |
| 23 | if path.as_os_str().is_empty() { |
| 24 | tracing::warn!( |
| 25 | env = SYSTEM_GATEWAY_DIR_ENV, |
| 26 | "ignoring empty system gateway dir override" |
| 27 | ); |
| 28 | return None; |
| 29 | } |
| 30 | if !path.is_absolute() { |
| 31 | tracing::warn!( |
| 32 | env = SYSTEM_GATEWAY_DIR_ENV, |
| 33 | path = %path.display(), |
| 34 | "ignoring relative system gateway dir override" |
| 35 | ); |
| 36 | return None; |
| 37 | } |
| 38 | Some(path) |
| 39 | } |
| 40 | |
| 41 | pub fn validated_gateway_name(name: &str) -> Result<&str> { |
| 42 | let mut components = Path::new(name).components(); |
no test coverage detected