Merge pull request #8 from Natureshadow/patch-2

Allow specifying listen address
This commit is contained in:
Rodrigue Chakode 2022-04-29 10:14:46 +02:00 committed by GitHub
commit f3b3fd0fe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -77,6 +77,7 @@ func main() {
viper.SetDefault("EMAIL_SUBJECT", "Thanks to try our product")
viper.SetDefault("DEMO_URL", "http://company.com/product-demo")
host := os.Getenv("HOST")
port := os.Getenv("PORT")
if port == "" {
port = "8080"
@ -90,5 +91,5 @@ func main() {
log.Printf("Listening on port %s", port)
log.Fatal(http.ListenAndServe(":"+port, nil))
log.Fatal(http.ListenAndServe(host+":"+port, nil))
}