diff --git a/node/api/setup/setup.go b/node/api/setup/setup.go index 6cbbc50..c26da1d 100644 --- a/node/api/setup/setup.go +++ b/node/api/setup/setup.go @@ -126,7 +126,6 @@ func (s *Setup) terraformCreate(req *dto.SetupRequest) (*dto.SetupResponse, erro AuthEnv: n.AuthEnv(), ResourceTags: n.ResourceTags(), } - var t string if n.GithubAuthEnabled() { publicKey, privateKey, err := token.KeyPair() if err != nil { @@ -134,12 +133,6 @@ func (s *Setup) terraformCreate(req *dto.SetupRequest) (*dto.SetupResponse, erro } data.PublicKey = publicKey data.PrivateKey = privateKey - t, err = token.JWT(privateKey, &domain.AccessTokenClaims{ - Node: n, - }, 7*24*time.Hour) - if err != nil { - return nil, err - } } tf, err := terraform.Setup(data) if err != nil { @@ -161,6 +154,15 @@ func (s *Setup) terraformCreate(req *dto.SetupRequest) (*dto.SetupResponse, erro if err := s.store.Put(domain.NodeConfigKey, n); err != nil { return nil, err } + var t string + if n.GithubAuthEnabled() { + t, err = token.JWT(data.PrivateKey, &domain.AccessTokenClaims{ + Node: n, + }, 7*24*time.Hour) + if err != nil { + return nil, err + } + } return &dto.SetupResponse{ APIGatewayRestURL: url, CliRole: cliRole,