From 4065d8842beb5d1648131bd5b1951adf7a27b5b7 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 16 Aug 2026 16:25:35 +0900 Subject: refactor(env): route Shirabe's own env reads through the shim These sites have no PHP counterpart to mirror, so they read std::env directly. Going through the shim's getenv() keeps every environment read in one place and lets a lint forbid the direct form. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe-php-shim/src/net.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/shirabe-php-shim/src') diff --git a/crates/shirabe-php-shim/src/net.rs b/crates/shirabe-php-shim/src/net.rs index e5d3fcf0..1519e6e0 100644 --- a/crates/shirabe-php-shim/src/net.rs +++ b/crates/shirabe-php-shim/src/net.rs @@ -7,7 +7,11 @@ pub fn gethostname() -> String { .ok() .map(|s| s.trim().to_string()) .filter(|s| !s.is_empty()) - .or_else(|| std::env::var("HOSTNAME").ok().filter(|s| !s.is_empty())) + .or_else(|| { + crate::getenv("HOSTNAME") + .map(|s| s.to_string_lossy().into_owned()) + .filter(|s| !s.is_empty()) + }) .unwrap_or_else(|| "localhost".to_string()) } -- cgit v1.3.1-4-g156e