rename RemoteHosts to AllowHosts

This is what I probably should have called this when I renamed it back
in 70276f36, since this makes it more obvious that it's a list of
allowed hosts.  Renaming now to make room for a `DenyHosts` variable as
part of #85.
This commit is contained in:
Will Norris 2019-03-17 03:05:13 +00:00
parent 4acc0b24ce
commit 5eab3024c6
3 changed files with 37 additions and 37 deletions

View file

@ -42,8 +42,8 @@ import (
const defaultMemorySize = 100
var addr = flag.String("addr", "localhost:8080", "TCP address to listen on")
var remoteHosts = flag.String("remoteHosts", "", "comma separated list of allowed remote hosts")
var whitelist = flag.String("whitelist", "", "deprecated. use 'remoteHosts' instead")
var allowHosts = flag.String("allowHosts", "", "comma separated list of allowed remote hosts")
var whitelist = flag.String("whitelist", "", "deprecated. use 'allowHosts' 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
@ -61,14 +61,14 @@ func init() {
func main() {
flag.Parse()
if *remoteHosts == "" {
if *allowHosts == "" {
// backwards compatible with old naming of the flag
*remoteHosts = *whitelist
*allowHosts = *whitelist
}
p := imageproxy.NewProxy(nil, cache.Cache)
if *remoteHosts != "" {
p.RemoteHosts = strings.Split(*remoteHosts, ",")
if *allowHosts != "" {
p.AllowHosts = strings.Split(*allowHosts, ",")
}
if *referrers != "" {
p.Referrers = strings.Split(*referrers, ",")