Skip to content

Commit

Permalink
[enh] add environment variable support to configure listen address an…
Browse files Browse the repository at this point in the history
…d secret key - closes #56
  • Loading branch information
asciimoo committed May 30, 2018
1 parent 7d69460 commit 21d656b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions morty.go
Expand Up @@ -13,6 +13,7 @@ import (
"log"
"mime"
"net/url"
"os"
"path/filepath"
"regexp"
"strings"
Expand Down Expand Up @@ -967,9 +968,13 @@ func (p *Proxy) serveMainPage(ctx *fasthttp.RequestCtx, statusCode int, err erro
}

func main() {

listen := flag.String("listen", "127.0.0.1:3000", "Listen address")
key := flag.String("key", "", "HMAC url validation key (hexadecimal encoded) - leave blank to disable")
default_listen_addr := os.Getenv("MORTY_ADDRESS")
if default_listen_addr == "" {
default_listen_addr = "127.0.0.1:3000"
}
default_key := os.Getenv("MORTY_KEY")
listen := flag.String("listen", default_listen_addr, "Listen address")
key := flag.String("key", default_key, "HMAC url validation key (hexadecimal encoded) - leave blank to disable validation")
ipv6 := flag.Bool("ipv6", false, "Allow IPv6 HTTP requests")
version := flag.Bool("version", false, "Show version")
requestTimeout := flag.Uint("timeout", 2, "Request timeout")
Expand Down

0 comments on commit 21d656b

Please sign in to comment.