Skip to content

Commit f0b97e4

Browse files
authored
add confirmation for secret overwrite (#660)
1 parent acc5c0f commit f0b97e4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

cmd/lk/agent.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,25 @@ func updateAgentSecrets(ctx context.Context, cmd *cli.Command) error {
973973
return err
974974
}
975975

976+
var confirmOverwrite bool
977+
if cmd.Bool("overwrite") {
978+
if err := huh.NewForm(
979+
huh.NewGroup(
980+
huh.NewConfirm().
981+
Title(fmt.Sprintf("This will remove all existing secrets. Are you sure you want to proceed [%s]?", agentID)).
982+
Value(&confirmOverwrite).
983+
Inline(false).
984+
WithTheme(util.Theme),
985+
),
986+
).Run(); err != nil {
987+
return err
988+
}
989+
}
990+
991+
if !confirmOverwrite {
992+
return nil
993+
}
994+
976995
req := &lkproto.UpdateAgentSecretsRequest{
977996
AgentId: agentID,
978997
Secrets: secrets,

0 commit comments

Comments
 (0)