Skip to content

Commit

Permalink
Show N/A in reusable when key is ephemeral
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfont committed Jul 11, 2021
1 parent 29b80e3 commit db20985
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/headscale/cli/preauthkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,19 @@ var ListPreAuthKeys = &cobra.Command{
if k.Expiration != nil {
expiration = k.Expiration.Format("2006-01-02 15:04:05")
}

var reusable string
if k.Ephemeral {
reusable = "N/A"
} else {
reusable = fmt.Sprintf("%v", k.Reusable)
}

fmt.Printf(
"key: %s, namespace: %s, reusable: %v, ephemeral: %v, expiration: %s, created_at: %s\n",
"key: %s, namespace: %s, reusable: %s, ephemeral: %v, expiration: %s, created_at: %s\n",
k.Key,
k.Namespace.Name,
k.Reusable,
reusable,
k.Ephemeral,
expiration,
k.CreatedAt.Format("2006-01-02 15:04:05"),
Expand Down

0 comments on commit db20985

Please sign in to comment.