Skip to content

Commit 37af78e

Browse files
committed
refactor: handle errors when loading public config
1 parent 87d9a03 commit 37af78e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

pkg/gateway_light/gateway.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,10 @@ func (g *gatewayModule) SetNamedProxy(wlID string, config zos.GatewayNameProxy)
586586

587587
// Get public config for node IP validation
588588
netStub := stubs.NewNetworkerLightStub(g.cl)
589-
pubConfig, _ := netStub.LoadPublicConfig(ctx)
589+
pubConfig, err := netStub.LoadPublicConfig(ctx)
590+
if err != nil {
591+
return "", errors.Wrap(err, "failed to load public config")
592+
}
590593

591594
if err := g.validateNameContract(config.Name, twinID); err != nil {
592595
return "", errors.Wrap(err, "failed to verify name contract")
@@ -624,7 +627,10 @@ func (g *gatewayModule) SetFQDNProxy(wlID string, config zos.GatewayFQDNProxy) e
624627

625628
// Get public config for node IP validation
626629
netStub := stubs.NewNetworkerLightStub(g.cl)
627-
pubConfig, _ := netStub.LoadPublicConfig(ctx)
630+
pubConfig, err := netStub.LoadPublicConfig(ctx)
631+
if err != nil {
632+
return errors.Wrap(err, "failed to load public config")
633+
}
628634

629635
if domain != "" && strings.HasSuffix(config.FQDN, domain) {
630636
return errors.New("can't create a fqdn workload with a subdomain of the gateway's managed domain")

0 commit comments

Comments
 (0)