Skip to content

Commit

Permalink
falling back to PORT env variable if HTTP_PORT is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
jprobinson committed Apr 5, 2019
1 parent b51b914 commit 6938ff7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/kit/config.go
@@ -1,7 +1,9 @@
package kit

import (
"os"
"runtime"
"strconv"
"time"

"github.com/kelseyhightower/envconfig"
Expand Down Expand Up @@ -53,7 +55,12 @@ func loadConfig() Config {
var cfg Config
envconfig.MustProcess("", &cfg)
if cfg.HTTPPort == 0 {
cfg.HTTPPort = 8080
var err error
// fall back to PORT for GAE
cfg.HTTPPort, err = strconv.Atoi(os.Getenv("PORT"))
if err != nil {
cfg.HTTPPort = 8080
}
}
if cfg.RPCPort == 0 {
cfg.RPCPort = 8081
Expand Down

0 comments on commit 6938ff7

Please sign in to comment.