summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-08 13:19:14 -0500
committerJeff Carr <[email protected]>2024-10-08 13:19:14 -0500
commit0e3fc9cb80f80f62aa737b659182e75588411c85 (patch)
tree57575fdd067fbf543469fb83844910cce4114efb /main.go
parentcc534d83da1aa4f19edf5a28c4d3d3dacf97273b (diff)
add args
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/main.go b/main.go
index 61487a3..02e3144 100644
--- a/main.go
+++ b/main.go
@@ -45,6 +45,16 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
}
func main() {
+ var hostname string = args.Hostname
+
+ if hostname == "" {
+ hostname = "localhost"
+ }
+
+ log.Info("curl http://" + hostname + ":3000/powersource # shows if your power grid is up")
+ log.Info("curl http://" + hostname + ":3000/lastoutage # shows the last time your power grid went down")
+ log.Info("hostname =", hostname)
+
http.HandleFunc("/", okHandler)
err := http.ListenAndServe(":3000", nil)
if err != nil {