rename 'Whitelist' to 'RemoteHosts"

This better describes what exactly is being allowed.
This commit is contained in:
Will Norris 2018-09-15 05:49:33 +00:00
parent 0370572130
commit 70276f36bc
7 changed files with 61 additions and 49 deletions

View file

@ -42,7 +42,8 @@ import (
const defaultMemorySize = 100
var addr = flag.String("addr", "localhost:8080", "TCP address to listen on")
var whitelist = flag.String("whitelist", "", "comma separated list of allowed remote hosts")
var remoteHosts = flag.String("remoteHosts", "", "comma separated list of allowed remote hosts")
var whitelist = flag.String("whitelist", "", "deprecated. use 'remoteHosts' instead")
var referrers = flag.String("referrers", "", "comma separated list of allowed referring hosts")
var baseURL = flag.String("baseURL", "", "default base URL for relative remote URLs")
var cache tieredCache
@ -59,10 +60,14 @@ func init() {
func main() {
flag.Parse()
if *remoteHosts == "" {
// backwards compatible with old naming of the flag
*remoteHosts = *whitelist
}
p := imageproxy.NewProxy(nil, cache.Cache)
if *whitelist != "" {
p.Whitelist = strings.Split(*whitelist, ",")
if *remoteHosts != "" {
p.RemoteHosts = strings.Split(*remoteHosts, ",")
}
if *referrers != "" {
p.Referrers = strings.Split(*referrers, ",")