Skip to content

Commit 3506b3e

Browse files
authored
Merge pull request #52 from Infisical/fix/enable-local-development
feat: add development mode handling for gateway registration and host key validation
2 parents 344ce81 + bb0b805 commit 3506b3e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/gateway-v2/gateway.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ func (g *Gateway) registerGateway() error {
374374
return fmt.Errorf("failed to register gateway: %v", err)
375375
}
376376

377+
if util.CLI_VERSION == "devel" && certResp.RelayHost == "host.docker.internal" {
378+
certResp.RelayHost = "127.0.0.1"
379+
}
380+
377381
g.GatewayID = certResp.GatewayID
378382
g.certificates = &certResp
379383
log.Info().Msgf("Successfully registered gateway and received certificates")
@@ -505,6 +509,12 @@ func (g *Gateway) createHostKeyCallback() ssh.HostKeyCallback {
505509
return fmt.Errorf("host certificates required, raw host keys not allowed")
506510
}
507511

512+
// no host cert check when in dev mode
513+
if util.CLI_VERSION == "devel" {
514+
fmt.Println("Gateway running in development mode, skipping host certificate validation")
515+
return nil
516+
}
517+
508518
return g.validateHostCertificate(cert, hostname, caKey)
509519
}
510520
}

0 commit comments

Comments
 (0)