Skip to content

Commit 32675c0

Browse files
committed
fix: pass relay name to systemd install, use correct operation name in CallConnectGateway
1 parent feba1f7 commit 32675c0

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

packages/api/api.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const (
4848
operationCallRegisterOrgRelay = "CallRegisterOrgRelay"
4949
operationCallGetOrgRelays = "CallGetOrgRelays"
5050
operationCallRegisterGateway = "CallRegisterGateway"
51+
operationCallConnectGateway = "CallConnectGateway"
5152
operationCallEnrollGateway = "CallEnrollGateway"
5253
operationCallPAMAccess = "CallPAMAccess"
5354
operationCallPAMAccessApprovalRequest = "CallPAMAccessApprovalRequest"
@@ -906,11 +907,11 @@ func CallConnectGateway(httpClient *resty.Client, request ConnectGatewayRequest)
906907
Post(fmt.Sprintf("%v/v3/gateways/connect", config.INFISICAL_URL))
907908

908909
if err != nil {
909-
return RegisterGatewayResponse{}, NewGenericRequestError(operationCallRegisterGateway, err)
910+
return RegisterGatewayResponse{}, NewGenericRequestError(operationCallConnectGateway, err)
910911
}
911912

912913
if response.IsError() {
913-
return RegisterGatewayResponse{}, NewAPIErrorWithResponse(operationCallRegisterGateway, response, nil)
914+
return RegisterGatewayResponse{}, NewAPIErrorWithResponse(operationCallConnectGateway, response, nil)
914915
}
915916

916917
return resBody, nil

packages/cmd/gateway.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,8 @@ var gatewaySystemdInstallCmd = &cobra.Command{
565565
util.HandleError(errors.New("--token is required when --enroll-method=token"))
566566
}
567567

568+
relayName, _ := util.GetRelayName(cmd, false, "")
569+
568570
httpClient, clientErr := util.GetRestyClientWithCustomHeaders()
569571
if clientErr != nil {
570572
util.HandleError(clientErr, "unable to create HTTP client")
@@ -579,7 +581,7 @@ var gatewaySystemdInstallCmd = &cobra.Command{
579581
}
580582

581583
// Install systemd service using the long-lived access token
582-
if installErr := gatewayv2.InstallEnrolledGatewaySystemdService(enrollResp.AccessToken, domain, gatewayName, "", serviceLogFile); installErr != nil {
584+
if installErr := gatewayv2.InstallEnrolledGatewaySystemdService(enrollResp.AccessToken, domain, gatewayName, relayName, serviceLogFile); installErr != nil {
583585
util.HandleError(installErr, "Unable to install systemd service")
584586
}
585587
} else {

0 commit comments

Comments
 (0)