adds ability to set an env in the app context

This commit is contained in:
2018-01-04 07:32:15 +00:00
parent 95400f4e69
commit 2d05e42555
7 changed files with 26 additions and 11 deletions
+3 -5
View File
@@ -14,6 +14,7 @@ import (
type Config struct {
IPAddr string
Port string
Env string
}
func New(r Router) *App {
@@ -25,7 +26,7 @@ type App struct {
}
func (a *App) Serve(cfg Config) error {
log.Printf("http server running @ %s:%s", cfg.IPAddr, cfg.Port)
log.Printf("http server running @ http://%s:%s", cfg.IPAddr, cfg.Port)
r := mux.NewRouter()
@@ -60,8 +61,5 @@ func (a *App) Serve(cfg Config) error {
}()
// start the web server
if err := server.ListenAndServe(); err != nil {
return err
}
return nil
return server.ListenAndServe()
}