Skip to content

Commit

Permalink
Allow overriding port by env
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Oct 27, 2017
1 parent cc61681 commit f3feeb6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/ntw-web/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ func main() {
app.Version = ntw.Version
app.Usage = "number to number web API"

defaultListen := ":" + os.Getenv("PORT")
if defaultListen == ":" {
defaultListen = ":8000"
}
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "bind, b",
Usage: "HTTP bind address",
Value: ":8000",
Value: defaultListen,
},
}
app.Action = server
Expand Down

0 comments on commit f3feeb6

Please sign in to comment.