arnaucube
arnaucube/kindle-weatherPublic Self-hosted repository
Add port flag
arnaucube root@arnaucube.com
Sun, 10 Apr 2022 18:53:39 +0200
commit

6ef7059e9741dcdcad59598f3886478a5aa1b98b

parent

386c7802cf25007a55b6e64b5821e326a97b47cf

1 files changed, 5 insertions(+), 4 deletions(-)

jump to
M main.go → main.go

@@ -61,11 +61,12 @@ return d, nil

} func main() { - if len(os.Args) != 2 { - fmt.Println("need an openwathermap.org API key as arg") + if len(os.Args) != 3 { + fmt.Println("need an openwathermap.org API key as arg & port") os.Exit(0) } apiKey := os.Args[1] + port := os.Args[2] tmpl := template.Must(template.ParseFiles("template.html"))

@@ -80,6 +81,6 @@ }

tmpl.Execute(w, data) }) - fmt.Println("serving at :8080") - http.ListenAndServe(":8080", nil) + fmt.Println("serving at :" + port) + http.ListenAndServe(":"+port, nil) }