fix: final docs.rs L11 path cleanup
Issue: Previous edit missed L11 hardcoded path
Solution: Use same env var + current_exe() pattern as L24
Verification: strings shows 0 dev paths in binary
D-4: ✅ Complete
This commit is contained in:
+8
-1
@@ -8,7 +8,14 @@ async fn doc_redirect() -> axum::response::Redirect {
|
||||
|
||||
async fn wasm_doc_handler() -> Result<impl axum::response::IntoResponse, (StatusCode, &'static str)>
|
||||
{
|
||||
let path = std::path::Path::new("/Users/accusys/momentry_core/docs_v1.0/doc_wasm/index.html");
|
||||
let base_str = std::env::var("MOMENTRY_DOCS_DIR")
|
||||
.unwrap_or_else(|_| {
|
||||
std::env::current_exe()
|
||||
.ok()
|
||||
.and_then(|p| p.parent().map(|d| d.join("docs_v1.0/doc_wasm").to_string_lossy().to_string()))
|
||||
.unwrap_or_else(|| "docs_v1.0/doc_wasm".to_string())
|
||||
});
|
||||
let path = std::path::Path::new(&base_str).join("index.html");
|
||||
match tokio::fs::read_to_string(path).await {
|
||||
Ok(html) => Ok(([("content-type", "text/html; charset=utf-8")], html)),
|
||||
Err(_) => Err((StatusCode::NOT_FOUND, "Doc not found")),
|
||||
|
||||
Reference in New Issue
Block a user