| 299 | } |
| 300 | |
| 301 | func applyConfig(cfg *config.Config) error { |
| 302 | if proxy == nil || proxyConfigChanged(&cfg.ConnectionPool, proxy) { |
| 303 | proxy = newReverseProxy(&cfg.ConnectionPool) |
| 304 | } |
| 305 | if err := proxy.applyConfig(cfg); err != nil { |
| 306 | return err |
| 307 | } |
| 308 | allowedNetworksHTTP.Store(&cfg.Server.HTTP.AllowedNetworks) |
| 309 | allowedNetworksHTTPS.Store(&cfg.Server.HTTPS.AllowedNetworks) |
| 310 | allowedNetworksMetrics.Store(&cfg.Server.Metrics.AllowedNetworks) |
| 311 | proxyHandler.Store(NewProxyHandler(&cfg.Server.Proxy)) |
| 312 | allowPing.Store(cfg.AllowPing) |
| 313 | log.SetDebug(cfg.LogDebug) |
| 314 | log.Infof("Loaded config:\n%s", cfg) |
| 315 | |
| 316 | return nil |
| 317 | } |
| 318 | |
| 319 | func reloadConfig() error { |
| 320 | cfg, err := loadConfig() |