Skip to content

Commit 88908ae

Browse files
fix: HTTPRemoteRestService config missing Direct ChannelMode (#3025)
* fix: HTTPRemoteRestService config missing Direct ChannelMode * refactor: fix lint on rewriting if-else to switch statement * refactor: simplify copy channel mode from cnsconfig * refactor: use safe type assertion to prevent potential panics Co-authored-by: Timothy J. Raymond <[email protected]> Signed-off-by: Jackie Luc <[email protected]> --------- Signed-off-by: Jackie Luc <[email protected]> Co-authored-by: Timothy J. Raymond <[email protected]>
1 parent bee72ee commit 88908ae

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cns/service/main.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -652,16 +652,14 @@ func main() {
652652
return
653653
}
654654

655+
// copy ChannelMode from cnsconfig to HTTPRemoteRestService config
656+
config.ChannelMode = cnsconfig.ChannelMode
655657
if cnsconfig.ChannelMode == cns.Managed {
656-
config.ChannelMode = cns.Managed
657658
privateEndpoint = cnsconfig.ManagedSettings.PrivateEndpoint
658659
infravnet = cnsconfig.ManagedSettings.InfrastructureNetworkID
659660
nodeID = cnsconfig.ManagedSettings.NodeID
660-
} else if cnsconfig.ChannelMode == cns.CRD {
661-
config.ChannelMode = cns.CRD
662-
} else if cnsconfig.ChannelMode == cns.MultiTenantCRD {
663-
config.ChannelMode = cns.MultiTenantCRD
664-
} else if acn.GetArg(acn.OptManaged).(bool) {
661+
}
662+
if isManaged, ok := acn.GetArg(acn.OptManaged).(bool); ok && isManaged {
665663
config.ChannelMode = cns.Managed
666664
}
667665

0 commit comments

Comments
 (0)