0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

switch port flag to addr to allow specifying host

This commit is contained in:
Will Norris 2013-12-04 03:58:26 -08:00
parent deaf0abd50
commit 402e2c7d83

View file

@ -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()