mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-12-17 22:20:11 +01:00
31 lines
773 B
Go
31 lines
773 B
Go
|
package cmd
|
||
|
|
||
|
import (
|
||
|
"github.com/spf13/cobra"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
vaultRekeyCmd.PersistentFlags().StringVar(&targetVaultArgs.oldKey, "old-key", "", "Old encryption key")
|
||
|
|
||
|
vaultCmd.AddCommand(vaultRekeyCmd)
|
||
|
}
|
||
|
|
||
|
var vaultRekeyCmd = &cobra.Command{
|
||
|
Use: "rekey",
|
||
|
Short: "Re-encrypt Key Store in database with using current encryption key",
|
||
|
Long: "To update the encryption key, modify it within the configuration file and " +
|
||
|
"then employ the 'vault rekey --old-key <old-key>' command to ensure the re-encryption of the " +
|
||
|
"pre-existing keys stored in the database.",
|
||
|
Run: func(cmd *cobra.Command, args []string) {
|
||
|
store := createStore("")
|
||
|
defer store.Close("")
|
||
|
|
||
|
err := store.RekeyAccessKeys(targetVaultArgs.oldKey)
|
||
|
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
},
|
||
|
}
|