configInit initialises all services, destinations, healthchecks and VIPs for a vserver.
(config *config.Vserver)
| 624 | // configInit initialises all services, destinations, healthchecks and VIPs for |
| 625 | // a vserver. |
| 626 | func (v *vserver) configInit(config *config.Vserver) { |
| 627 | v.config = config |
| 628 | v.enabled = vserverEnabled(config, v.vserverOverride.State()) |
| 629 | newSvcs := v.expandServices() |
| 630 | // Preserve stats if this is a reinit |
| 631 | for svcK, svc := range newSvcs { |
| 632 | svc.dests = v.expandDests(svc) |
| 633 | if oldSvc, ok := v.services[svcK]; ok { |
| 634 | *svc.stats = *oldSvc.stats |
| 635 | for dstK, dst := range svc.dests { |
| 636 | if oldDst, ok := oldSvc.dests[dstK]; ok { |
| 637 | *dst.stats = *oldDst.stats |
| 638 | } |
| 639 | } |
| 640 | } |
| 641 | } |
| 642 | v.services = newSvcs |
| 643 | v.checks = v.expandChecks() |
| 644 | if v.enabled { |
| 645 | v.configureVIPs() |
| 646 | } |
| 647 | return |
| 648 | } |
| 649 | |
| 650 | // configUpdate updates the services, destinations, checks, and VIPs for a |
| 651 | // vserver. |
no test coverage detected