Browse Source

Allow bind to be configured through env vars

Goji now honors two environment variables: GOJI_BIND (which accepts the
full "bind" flag syntax) and PORT (which is treated as a TCP port).

Ref #20.
Carl Jackson 12 years ago
parent
commit
8770437237
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      bind/bind.go

+ 5
- 1
bind/bind.go View File

@ -41,10 +41,14 @@ func init() {
systemdInit()
defaultBind := ":8000"
if usingEinhorn() {
if bind := os.Getenv("GOJI_BIND"); bind != "" {
defaultBind = bind
} else if usingEinhorn() {
defaultBind = "einhorn@0"
} else if usingSystemd() {
defaultBind = "fd@3"
} else if port := os.Getenv("PORT"); port != "" {
defaultBind = ":" + port
}
flag.StringVar(&bind, "bind", defaultBind,
`Address to bind on. If this value has a colon, as in ":8000" or


Loading…
Cancel
Save