]> Humopery - waterslager.git/commitdiff
rename root_path -> app_root
authorfozzie <fozzie@humopery.space>
Sat, 19 Jul 2025 21:42:56 +0000 (16:42 -0500)
committerfozzie <fozzie@humopery.space>
Sat, 19 Jul 2025 21:42:56 +0000 (16:42 -0500)
.env
src/handler.rs
src/main.rs

diff --git a/.env b/.env
index 6575ac82295e5d1e1f03603197ad2cb3cb8f9738..6589a0b41ce970eacadb2ad0412db96ed44d5653 100644 (file)
--- a/.env
+++ b/.env
@@ -5,4 +5,4 @@
 # BIND_PORT=3000
 
 # Locate app at / or e.g. /certcheck
-# ROOT_PATH=/
+# APP_ROOT=/
index a06fcde3c29f29a810799cafb6987a82381d1e3c..ebecbbceda2595ee34aae42f5d1a381cdf83a254 100644 (file)
@@ -33,7 +33,7 @@ pub async fn show_check_form(State(state): State<AppState>) -> impl IntoResponse
        key_fingerprint: None,
        key_description: None,
        error: None,
-       post_target: Some(state.root_path),
+       post_target: Some(state.app_root),
     }.render().unwrap())
 }
 
@@ -98,7 +98,7 @@ fn decode_message_bytes(content: Vec<u8>, helper: Helper, url: String, State(sta
            error: None,
            key_fingerprint: helper.get_fingerprint(),
            key_description: helper.get_description(),
-           post_target: Some(state.root_path),
+           post_target: Some(state.app_root),
        }.render().unwrap())),
        _ => error_response(StatusCode::BAD_REQUEST,
                            "Unable to decode signed doc into UTF-8".to_string())
index 09670b440b886c67ee6487f6c8be55f5d7cb32af..87d8f7e23d5c8080067366c72c32f08d3cd23f85 100644 (file)
@@ -11,7 +11,7 @@ use tokio::net::TcpListener;
 #[derive(Clone)]
 struct AppState {
     certs: CertMap,
-    root_path: String,
+    app_root: String,
 }
 
 pub type CertMap = HashMap<String,(String,String)>;
@@ -43,22 +43,22 @@ async fn main() -> Result<(),Box<dyn std::error::Error>> {
     unsafe {
        env::set_var("BIND_HOST","127.0.0.1");
        env::set_var("BIND_PORT","3000");
-       env::set_var("ROOT_PATH", "/");
+       env::set_var("APP_ROOT", "/");
     }
     // ... then override from .env, ignoring any error (file may not be there)
     let _ = dotenvy::dotenv_override();
 
     let certs = load_certs_from_fs().await.unwrap();
 
-    let root_path = env::var("ROOT_PATH")?;
+    let app_root = env::var("APP_ROOT")?;
     let app_state = AppState{
        certs,
-       root_path: root_path.clone(),
+       app_root: app_root.clone(),
     };
 
     let all_routes = Router::new()
-       .route(&root_path, get(handler::show_check_form))
-       .route(&root_path, post(handler::check_canary_result))
+       .route(&app_root, get(handler::show_check_form))
+       .route(&app_root, post(handler::check_canary_result))
        .with_state(app_state);
 
     let addr = SocketAddr::new(