Skip to content

Commit c776750

Browse files
authored
feat: Add Sync Run API Token Type (#1473)
#### Summary <!-- 🎉 Thank you for making CloudQuery awesome by submitting a PR 🎉 --> Goes with cloudquery/cloudquery-api-go#109 --- Use the following steps to ensure your PR is ready to be reviewed - [ ] Read the [contribution guidelines](../blob/main/CONTRIBUTING.md) 🧑‍🎓 - [ ] Run `go fmt` to format your code 🖊 - [ ] Lint your changes via `golangci-lint run` 🚨 (install golangci-lint [here](https://golangci-lint.run/usage/install/#local-installation)) - [ ] Update or add tests 🧪 - [ ] Ensure the status checks below are successful ✅
1 parent 01961cb commit c776750

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

premium/usage.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,12 @@ func (u *BatchUpdater) getTeamNameByTokenType(tokenType auth.TokenType) (string,
405405
return "", fmt.Errorf("expected to find exactly one team for API key, found %d", len(resp.JSON200.Items))
406406
}
407407
return resp.JSON200.Items[0].Name, nil
408+
case auth.SyncRunAPIKey:
409+
team := os.Getenv("_CQ_TEAM_NAME")
410+
if team == "" {
411+
return "", fmt.Errorf("_CQ_TEAM_NAME environment variable not set")
412+
}
413+
return team, nil
408414
default:
409415
return "", fmt.Errorf("unsupported token type: %v", tokenType)
410416
}

0 commit comments

Comments
 (0)