|
|
|
@ -57,10 +57,8 @@ func (m *Env) writeEnvZone(w io.Writer, z *Zone) {
|
|
|
|
|
m.writeEnvVar(w, z.Name, "ZONE%v_%s", zoneID, "NAME") |
|
|
|
|
|
|
|
|
|
// ZONE{zoneID}_GW
|
|
|
|
|
gatewayID := getRingZeroGatewayID(z) |
|
|
|
|
if gatewayID > 0 { |
|
|
|
|
m.writeEnvVar(w, fmt.Sprintf("%v", gatewayID), "ZONE%v_%s", zoneID, "GW") |
|
|
|
|
} |
|
|
|
|
gateways, _ := z.GatewayIDs() |
|
|
|
|
m.writeEnvVarInts(w, gateways, "ZONE%v_%s", zoneID, "GW") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (m *Env) writeEnvVarInts(w io.Writer, value []int, name string, args ...any) { |
|
|
|
@ -108,17 +106,3 @@ func genEnvZoneNodes(z *Zone) string {
|
|
|
|
|
} |
|
|
|
|
return "" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func getRingZeroGatewayID(z *Zone) int { |
|
|
|
|
var gatewayID int |
|
|
|
|
|
|
|
|
|
z.ForEachMachine(func(p *Machine) bool { |
|
|
|
|
if p.IsGateway() { |
|
|
|
|
gatewayID = p.ID |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return gatewayID != 0 |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
return gatewayID |
|
|
|
|
} |
|
|
|
|