diff options
| author | Jeff Carr <[email protected]> | 2024-10-08 13:19:14 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-08 13:19:14 -0500 |
| commit | 0e3fc9cb80f80f62aa737b659182e75588411c85 (patch) | |
| tree | 57575fdd067fbf543469fb83844910cce4114efb /main.go | |
| parent | cc534d83da1aa4f19edf5a28c4d3d3dacf97273b (diff) | |
add args
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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 { |
