Allow specifying listen address
This commit is contained in:
parent
477643b58e
commit
47e562362b
3
main.go
3
main.go
|
@ -77,6 +77,7 @@ func main() {
|
||||||
viper.SetDefault("EMAIL_SUBJECT", "Thanks to try our product")
|
viper.SetDefault("EMAIL_SUBJECT", "Thanks to try our product")
|
||||||
viper.SetDefault("DEMO_URL", "http://company.com/product-demo")
|
viper.SetDefault("DEMO_URL", "http://company.com/product-demo")
|
||||||
|
|
||||||
|
host := os.Getenv("HOST")
|
||||||
port := os.Getenv("PORT")
|
port := os.Getenv("PORT")
|
||||||
if port == "" {
|
if port == "" {
|
||||||
port = "8080"
|
port = "8080"
|
||||||
|
@ -90,5 +91,5 @@ func main() {
|
||||||
|
|
||||||
log.Printf("Listening on port %s", port)
|
log.Printf("Listening on port %s", port)
|
||||||
|
|
||||||
log.Fatal(http.ListenAndServe(":"+port, nil))
|
log.Fatal(http.ListenAndServe(host+":"+port, nil))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue