From 402e2c7d83634403325c19697df7b6af0e5cb466 Mon Sep 17 00:00:00 2001 From: Will Norris Date: Wed, 4 Dec 2013 03:58:26 -0800 Subject: [PATCH] switch port flag to addr to allow specifying host --- imageproxy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imageproxy.go b/imageproxy.go index 752974d..fde4d32 100644 --- a/imageproxy.go +++ b/imageproxy.go @@ -11,13 +11,13 @@ import ( "github.com/willnorris/go-imageproxy/proxy" ) -var port = flag.Int("port", 8080, "port to listen on") +var addr = flag.String("addr", "localhost:8080", "TCP address to listen on") var whitelist = flag.String("whitelist", "", "comma separated list of allowed remote hosts") func main() { flag.Parse() - fmt.Printf("go-imageproxy listening on port %d\n", *port) + fmt.Printf("go-imageproxy listening on %s\n", *addr) p := proxy.NewProxy(nil) p.Cache = cache.NewMemoryCache() @@ -25,7 +25,7 @@ func main() { p.Whitelist = strings.Split(*whitelist, ",") } server := &http.Server{ - Addr: fmt.Sprintf(":%d", *port), + Addr: *addr, Handler: p, } err := server.ListenAndServe()