diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.go b/src/main.go index 74f8f51..5a6d851 100644 --- a/src/main.go +++ b/src/main.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "log" "net/http" @@ -22,10 +23,14 @@ func main() { // create a cities map mapping a city to a location cities = make(map[string]location) + // parse flags building a config struct + config := parseFlags() + // start the ssh server log.Println("Starting SSH listener") go func() { - listenErr := ssh.ListenAndServe(":2222", nil, ssh.PasswordAuth(handlePass)) + sshPortString := fmt.Sprintf(":%d", config.sshPort) + listenErr := ssh.ListenAndServe(sshPortString, nil, ssh.PasswordAuth(handlePass)) if listenErr != nil { log.Fatalln(listenErr.Error()) } @@ -40,7 +45,8 @@ func main() { r.HandleFunc("/locations", locationHandlerEndpoint) // start the http server exposing the metrics and the locations - listenErr := http.ListenAndServe(":8084", r) + httpPortString := fmt.Sprintf(":%d", config.httpPort) + listenErr := http.ListenAndServe(httpPortString, r) // handle potential errors if listenErr != nil { |