mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 08:27:22 +00:00
feat: updated pr based on review
This commit is contained in:
@@ -237,6 +237,7 @@ func createDynamicSecretLeaseByName(cmd *cobra.Command, args []string) {
|
|||||||
fmt.Println("Dynamic Secret Leasing")
|
fmt.Println("Dynamic Secret Leasing")
|
||||||
fmt.Printf("Name: %s\n", dynamicSecretRootCredential.Name)
|
fmt.Printf("Name: %s\n", dynamicSecretRootCredential.Name)
|
||||||
fmt.Printf("Provider: %s\n", dynamicSecretRootCredential.Type)
|
fmt.Printf("Provider: %s\n", dynamicSecretRootCredential.Type)
|
||||||
|
fmt.Printf("Lease ID: %s\n", leaseDetails.Id)
|
||||||
fmt.Printf("Expire At: %s\n", leaseDetails.ExpireAt.Local().Format("02-Jan-2006 03:04:05 PM"))
|
fmt.Printf("Expire At: %s\n", leaseDetails.ExpireAt.Local().Format("02-Jan-2006 03:04:05 PM"))
|
||||||
visualize.PrintAllDyamicSecretLeaseCredentials(leaseCredentials)
|
visualize.PrintAllDyamicSecretLeaseCredentials(leaseCredentials)
|
||||||
}
|
}
|
||||||
@@ -245,7 +246,7 @@ func createDynamicSecretLeaseByName(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dynamicSecretLeaseRenewCmd = &cobra.Command{
|
var dynamicSecretLeaseRenewCmd = &cobra.Command{
|
||||||
Example: `lease create <dynamic secret name>"`,
|
Example: `lease renew <dynamic secret name>"`,
|
||||||
Short: "Used to renew dynamic secret lease by name",
|
Short: "Used to renew dynamic secret lease by name",
|
||||||
Use: "renew [lease-id]",
|
Use: "renew [lease-id]",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
|
|||||||
@@ -28,8 +28,9 @@ func PrintAllDynamicRootCredentials(dynamicRootCredentials []infisicalModels.Dyn
|
|||||||
|
|
||||||
func PrintAllDynamicSecretLeases(dynamicSecretLeases []infisicalModels.DynamicSecretLease) {
|
func PrintAllDynamicSecretLeases(dynamicSecretLeases []infisicalModels.DynamicSecretLease) {
|
||||||
rows := [][]string{}
|
rows := [][]string{}
|
||||||
|
const timeformat = "02-Jan-2006 03:04:05 PM"
|
||||||
for _, el := range dynamicSecretLeases {
|
for _, el := range dynamicSecretLeases {
|
||||||
rows = append(rows, []string{el.Id, el.ExpireAt.Local().Format("02-Jan-2006 03:04:05 PM"), el.CreatedAt.Local().Format("02-Jan-2006 03:04:05 PM")})
|
rows = append(rows, []string{el.Id, el.ExpireAt.Local().Format(timeformat), el.CreatedAt.Local().Format(timeformat)})
|
||||||
}
|
}
|
||||||
|
|
||||||
headers := []string{"ID", "Expire At", "Created At"}
|
headers := []string{"ID", "Expire At", "Created At"}
|
||||||
|
|||||||
@@ -95,25 +95,6 @@ func getLongestValues(rows [][3]string) (longestSecretName, longestSecretType in
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GenericTable(headers []string, rows [][]string) {
|
func GenericTable(headers []string, rows [][]string) {
|
||||||
// if we're not in a terminal or cygwin terminal, don't truncate the secret value
|
|
||||||
shouldTruncate := isatty.IsTerminal(os.Stdout.Fd())
|
|
||||||
|
|
||||||
// This will return an error if we're not in a terminal or
|
|
||||||
// if the terminal is a cygwin terminal like Git Bash.
|
|
||||||
width, _, err := term.GetSize(int(os.Stdout.Fd()))
|
|
||||||
if err != nil {
|
|
||||||
if shouldTruncate {
|
|
||||||
log.Error().Msgf("error getting terminal size: %s", err)
|
|
||||||
} else {
|
|
||||||
log.Debug().Err(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
availableWidth := width - borderWidths
|
|
||||||
if availableWidth < 0 {
|
|
||||||
availableWidth = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
t := table.NewWriter()
|
t := table.NewWriter()
|
||||||
t.SetOutputMirror(os.Stdout)
|
t.SetOutputMirror(os.Stdout)
|
||||||
t.SetStyle(table.StyleLight)
|
t.SetStyle(table.StyleLight)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: "infisical dynamic-secrets"
|
title: "infisical dynamic-secrets"
|
||||||
description: "Perform various operations with Infisical dynamic secrets"
|
description: "Perform dynamic secret operations directly with the CLI"
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -9,6 +9,8 @@ infisical dynamic-secrets
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
|
Dynamic secrets are unique secrets generated on demand based on the provided configuration settings. For more details, refer to [dynamics secrets section](/documentation/platform/dynamic-secrets/overview).
|
||||||
|
|
||||||
This command enables you to perform list, lease, renew lease, and revoke lease operations on dynamic secrets within your Infisical project.
|
This command enables you to perform list, lease, renew lease, and revoke lease operations on dynamic secrets within your Infisical project.
|
||||||
|
|
||||||
### Sub-commands
|
### Sub-commands
|
||||||
|
|||||||
Reference in New Issue
Block a user