Merge pull request #8 from Natureshadow/patch-2
Allow specifying listen address
This commit is contained in:
		
						commit
						f3b3fd0fe8
					
				
							
								
								
									
										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))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in New Issue