From 2ec5943e0df74ee920803230e1a41edb62ac7d0f Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Mon, 26 Sep 2022 13:29:54 +0100
Subject: [PATCH] Allow customizing the page header/title

---
 main.go | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/main.go b/main.go
index 386e5bc..c50238a 100644
--- a/main.go
+++ b/main.go
@@ -21,13 +21,14 @@ var (
 		"ssh -o UserKnownHostsFile=/dev/null -i ~/.vagrant.d/insecure_private_key -J {{.JumpHost}} root@{{.Host.IP}}",
 		"format string for host-specific SSH connections")
 	enableSOCKS = flag.Bool("enable-socks", false, "show SOCKS5 connection params")
+	title       = flag.String("title", "VMine test cluster", "title string")
 )
 
 var (
 	dashTplSrc = `<!doctype html>
 <html lang="en">
 <head>
-  <title>VMine test cluster</title>
+  <title>{{.Title}}</title>
   <style type="text/css">
 body { background: white; }
 .name { font-size: 120%; }
@@ -41,7 +42,7 @@ body { background: white; }
 </head>
 <body>
 
-  <h1>VMine test cluster</h1>
+  <h1>{{.Title}}</h1>
 
   <h4>Hosts</h4>
 
@@ -152,11 +153,13 @@ func handleRequest(w http.ResponseWriter, req *http.Request) {
 		SocksIP     string
 		JumpHost    string
 		EnableSOCKS bool
+		Title       string
 	}{
 		Inventory:   inventory,
 		SocksIP:     inventory[0].IP,
 		JumpHost:    *jumpHost,
 		EnableSOCKS: *enableSOCKS,
+		Title:       *title,
 	})
 }
 
-- 
GitLab