1 parent
0b6dcbd547
commit
d48c1863bf
9 files changed
+222
-7
No files matched your search
@@ -717,6 +717,7 @@ func (a *App) onConfigSwap(cfg *config.Config) {
|
||||
a.log.Info("configuration applied", "version", cfg.Version)
|
||||
if a.pool != nil {
|
||||
a.pool.Rebind(cfg.Upstream)
|
||||
a.invalidateBlocklistCache()
|
||||
}
|
||||
a.reloadLocalZones()
|
||||
if a.blocks != nil && !cfg.Block.Enabled {
|
||||
|
||||
@@ -788,9 +788,11 @@ func (a *App) putACL(_ context.Context, groups []config.Group, def string) (int6
|
||||
// getUpstreams returns the pool state.
|
||||
func (a *App) getUpstreams() any {
|
||||
cfg := a.cfg.Get()
|
||||
servers := make([]resolver.Stats, 0, len(a.pool.All()))
|
||||
for _, s := range a.pool.Stats() {
|
||||
servers = append(servers, s)
|
||||
// Keep forwarding targets out of the editable default-server list.
|
||||
defaults := a.pool.Defaults()
|
||||
servers := make([]resolver.Stats, 0, len(defaults))
|
||||
for _, u := range defaults {
|
||||
servers = append(servers, u.Stats())
|
||||
}
|
||||
return map[string]any{
|
||||
"policy": cfg.Upstream.Policy,
|
||||
@@ -810,6 +812,8 @@ func (a *App) getUpstreams() any {
|
||||
// putUpstream validates and persists a new upstream config.
|
||||
func (a *App) putUpstream(_ context.Context, up config.Upstream) (int64, error) {
|
||||
err := a.mutateConfig(func(c *config.Config) error {
|
||||
// The console edits default servers; preserve YAML-only forwarding rules.
|
||||
up.ForwardZones = c.Upstream.ForwardZones
|
||||
c.Upstream = up
|
||||
return nil
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user