Added checks for access token when running command

This commit is contained in:
David J. Allen 2024-03-15 17:43:25 -06:00
parent 7760857ae5
commit 09c5af44b9
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC
3 changed files with 38 additions and 10 deletions

View file

@ -27,6 +27,16 @@ var collectCmd = &cobra.Command{
l.Log.Errorf("could not get states: %v", err)
}
// try to load access token either from env var, file, or config if var not set
if accessToken == "" {
var err error
accessToken, err = LoadAccessToken()
if err != nil {
l.Log.Errorf("failed to load access token: %v", err)
}
}
//
if threads <= 0 {
threads = mathutil.Clamp(len(probeStates), 1, 255)
}