Skip to content

Commit

Permalink
Improve token generation config output (#14454)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jun 18, 2024
1 parent 5f5d453 commit 09f9424
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions cmd/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ func runToken(cmd *cobra.Command, args []string) {
var token *oauth2.Token
var err error

if strings.ToLower(vehicleConf.Type) == "template" {
isTemplate := strings.ToLower(vehicleConf.Type) == "template"
if isTemplate {
instance, err := templates.RenderInstance(templates.Vehicle, vehicleConf.Other)
if err != nil {
log.FATAL.Fatalf("rendering template failed: %v", err)
Expand Down Expand Up @@ -84,8 +85,16 @@ func runToken(cmd *cobra.Command, args []string) {
fmt.Println()
fmt.Println("Add the following tokens to the vehicle config:")
fmt.Println()
fmt.Println(" type: " + typ)
fmt.Println(" tokens:")
fmt.Println(" access:", token.AccessToken)
fmt.Println(" refresh:", token.RefreshToken)

if isTemplate {
fmt.Println(" type: template")
fmt.Println(" template:", typ)
fmt.Println(" accesstoken:", token.AccessToken)
fmt.Println(" refreshtoken:", token.RefreshToken)
} else {
fmt.Println(" type:", typ)
fmt.Println(" tokens:")
fmt.Println(" access:", token.AccessToken)
fmt.Println(" refresh:", token.RefreshToken)
}
}

0 comments on commit 09f9424

Please sign in to comment.