Skip to content

Commit

Permalink
fix initial admin token
Browse files Browse the repository at this point in the history
  • Loading branch information
djelusic committed Mar 8, 2022
1 parent 72a8e77 commit e0ea1c0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions node/api/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,13 @@ 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 {
return nil, err
}
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 {
Expand All @@ -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,
Expand Down

0 comments on commit e0ea1c0

Please sign in to comment.