Update config encrypt/decrypt CLI command (#309)
This updates the command to our emergent standards. It also enables using a separate config file for a config kms, which allows non-string values to be encrypted. This allowed some nice cleanup as well.
This commit is contained in:
1 parent
274afa6b02
commit
28df6eb7b0
18 files changed
+307
-197
No files matched your search
@@ -18,6 +18,7 @@ import (
|
||||
|
||||
"github.com/hashicorp/boundary/api"
|
||||
"github.com/hashicorp/boundary/api/authtokens"
|
||||
"github.com/hashicorp/boundary/internal/wrapper"
|
||||
"github.com/hashicorp/boundary/recovery"
|
||||
"github.com/mitchellh/cli"
|
||||
"github.com/pkg/errors"
|
||||
@@ -183,10 +184,13 @@ func (c *Command) Client(opt ...Option) (*api.Client, error) {
|
||||
tokenName := "default"
|
||||
switch {
|
||||
case c.FlagRecoveryConfig != "":
|
||||
wrapper, err := recovery.GetWrapper(c.Context, c.FlagRecoveryConfig)
|
||||
wrapper, err := wrapper.GetWrapper(c.FlagRecoveryConfig, "recovery")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if wrapper == nil {
|
||||
return nil, errors.New(`No "kms" block with purpose "recovery" found`)
|
||||
}
|
||||
if err := wrapper.Init(c.Context); err != nil {
|
||||
return nil, fmt.Errorf("Error initializing kms: %w", err)
|
||||
}
|
||||
@@ -284,11 +288,6 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
|
||||
c.flagsOnce.Do(func() {
|
||||
set := NewFlagSets(c.UI)
|
||||
|
||||
// These flag sets will apply to all leaf subcommands.
|
||||
// TODO: Optional, but FlagSetHTTP can be safely removed from the individual
|
||||
// Flags() subcommands.
|
||||
bit = bit | FlagSetHTTP
|
||||
|
||||
if bit&FlagSetHTTP != 0 {
|
||||
f := set.NewFlagSet("Connection Options")
|
||||
|
||||
|
||||
@@ -213,7 +213,13 @@ func (b *Server) PrintInfo(ui cli.Ui, mode string) {
|
||||
}
|
||||
|
||||
// Server configuration output
|
||||
padding := 36
|
||||
padding := 0
|
||||
for _, k := range b.InfoKeys {
|
||||
currPadding := padding - len(k)
|
||||
if currPadding < 2 {
|
||||
padding = len(k) + 2
|
||||
}
|
||||
}
|
||||
sort.Strings(b.InfoKeys)
|
||||
ui.Output(fmt.Sprintf("==> Boundary %s configuration:\n", mode))
|
||||
for _, k := range b.InfoKeys {
|
||||
|
||||
Reference in new issue
Block a user