Skip to content

Commit 101db97

Browse files
authored
Fix bug with new preflight client and basic auth (#161)
Signed-off-by: Jose Fuentes <[email protected]>
1 parent 9566076 commit 101db97

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pkg/agent/run.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ func Run(cmd *cobra.Command, args []string) {
4444
log.Fatalf("Failed to parse config file: %s", err)
4545
}
4646

47+
// AuthToken flag takes preference over token in configuration file.
48+
if AuthToken == "" {
49+
AuthToken = config.Token
50+
} else {
51+
log.Printf("Using authorization token from flag.")
52+
}
53+
4754
if config.Token != "" {
4855
config.Token = "(redacted)"
4956
}
@@ -84,13 +91,6 @@ func Run(cmd *cobra.Command, args []string) {
8491
log.Fatalf("Error creating preflight client: %+v", err)
8592
}
8693
} else {
87-
// AuthToken flag takes preference over token in configuration file.
88-
if AuthToken == "" {
89-
AuthToken = config.Token
90-
} else {
91-
log.Printf("Using authorization token from flag.")
92-
}
93-
9494
if AuthToken == "" {
9595
log.Fatalf("Missing authorization token. Cannot continue.")
9696
}

0 commit comments

Comments
 (0)