Enable download of GeoLite2 databases (#4896)
This commit is contained in:
parent
58146c803b
commit
74944b99e9
4 changed files with 167 additions and 0 deletions
|
|
@ -181,6 +181,9 @@ Takes the form "<host>:port". If not provided, no admission controller is starte
|
|||
|
||||
flags.MarkDeprecated("enable-dynamic-certificates", `Only dynamic mode is supported`)
|
||||
|
||||
flags.StringVar(&nginx.MaxmindLicenseKey, "maxmind-license-key", "", `Maxmind license key to download GeoLite2 Databases.
|
||||
https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases`)
|
||||
|
||||
flag.Set("logtostderr", "true")
|
||||
|
||||
flags.AddGoFlagSet(flag.CommandLine)
|
||||
|
|
@ -297,5 +300,13 @@ Takes the form "<host>:port". If not provided, no admission controller is starte
|
|||
config.RootCAFile = *rootCAFile
|
||||
}
|
||||
|
||||
if nginx.MaxmindLicenseKey != "" {
|
||||
klog.Info("downloading maxmind GeoIP2 databases...")
|
||||
err := nginx.DownloadGeoLite2DB()
|
||||
if err != nil {
|
||||
klog.Errorf("unexpected error downloading GeoIP2 database: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
return false, config, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue