mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 11:08:10 +00:00
Add RunCustom command to allow passing in a TokenHelper
This commit is contained in:
@@ -114,6 +114,11 @@ func (c *BaseCommand) Client() (*api.Client, error) {
|
|||||||
return client, nil
|
return client, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetTokenHelper sets the token helper on the command.
|
||||||
|
func (c *BaseCommand) SetTokenHelper(th token.TokenHelper) {
|
||||||
|
c.tokenHelper = th
|
||||||
|
}
|
||||||
|
|
||||||
// TokenHelper returns the token helper attached to the command.
|
// TokenHelper returns the token helper attached to the command.
|
||||||
func (c *BaseCommand) TokenHelper() (token.TokenHelper, error) {
|
func (c *BaseCommand) TokenHelper() (token.TokenHelper, error) {
|
||||||
if c.tokenHelper != nil {
|
if c.tokenHelper != nil {
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ func (c *DeprecatedCommand) warn() {
|
|||||||
var Commands map[string]cli.CommandFactory
|
var Commands map[string]cli.CommandFactory
|
||||||
var DeprecatedCommands map[string]cli.CommandFactory
|
var DeprecatedCommands map[string]cli.CommandFactory
|
||||||
|
|
||||||
func initCommands(ui, serverCmdUi cli.Ui) {
|
func initCommands(ui, serverCmdUi cli.Ui, baseCmdTemplate *BaseCommand) {
|
||||||
loginHandlers := map[string]LoginHandler{
|
loginHandlers := map[string]LoginHandler{
|
||||||
"aws": &credAws.CLIHandler{},
|
"aws": &credAws.CLIHandler{},
|
||||||
"centrify": &credCentrify.CLIHandler{},
|
"centrify": &credCentrify.CLIHandler{},
|
||||||
@@ -206,6 +206,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &AuditCommand{
|
return &AuditCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -213,6 +214,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &AuditDisableCommand{
|
return &AuditDisableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -220,6 +222,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &AuditEnableCommand{
|
return &AuditEnableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -227,6 +230,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &AuditListCommand{
|
return &AuditListCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -234,6 +238,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &AuthTuneCommand{
|
return &AuthTuneCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -241,6 +246,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &AuthCommand{
|
return &AuthCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
Handlers: loginHandlers,
|
Handlers: loginHandlers,
|
||||||
}, nil
|
}, nil
|
||||||
@@ -249,6 +255,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &AuthDisableCommand{
|
return &AuthDisableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -256,6 +263,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &AuthEnableCommand{
|
return &AuthEnableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -263,6 +271,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &AuthHelpCommand{
|
return &AuthHelpCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
Handlers: loginHandlers,
|
Handlers: loginHandlers,
|
||||||
}, nil
|
}, nil
|
||||||
@@ -271,6 +280,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &AuthListCommand{
|
return &AuthListCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -278,6 +288,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &DeleteCommand{
|
return &DeleteCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -285,6 +296,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &LeaseCommand{
|
return &LeaseCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -292,6 +304,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &LeaseRenewCommand{
|
return &LeaseRenewCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -299,6 +312,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &LeaseRevokeCommand{
|
return &LeaseRevokeCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -306,6 +320,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &ListCommand{
|
return &ListCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -313,6 +328,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &LoginCommand{
|
return &LoginCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
Handlers: loginHandlers,
|
Handlers: loginHandlers,
|
||||||
}, nil
|
}, nil
|
||||||
@@ -321,6 +337,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &OperatorCommand{
|
return &OperatorCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -328,6 +345,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &OperatorGenerateRootCommand{
|
return &OperatorGenerateRootCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -335,6 +353,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &OperatorInitCommand{
|
return &OperatorInitCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -342,6 +361,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &OperatorKeyStatusCommand{
|
return &OperatorKeyStatusCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -349,6 +369,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &OperatorRekeyCommand{
|
return &OperatorRekeyCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -356,6 +377,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &OperatorRotateCommand{
|
return &OperatorRotateCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -363,6 +385,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &OperatorSealCommand{
|
return &OperatorSealCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -370,6 +393,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &OperatorStepDownCommand{
|
return &OperatorStepDownCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -377,6 +401,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &OperatorUnsealCommand{
|
return &OperatorUnsealCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -384,6 +409,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &PathHelpCommand{
|
return &PathHelpCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -391,6 +417,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &PolicyCommand{
|
return &PolicyCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -398,6 +425,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &PolicyDeleteCommand{
|
return &PolicyDeleteCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -405,6 +433,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &PolicyFmtCommand{
|
return &PolicyFmtCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -412,6 +441,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &PolicyListCommand{
|
return &PolicyListCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -419,6 +449,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &PolicyReadCommand{
|
return &PolicyReadCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -426,6 +457,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &PolicyWriteCommand{
|
return &PolicyWriteCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -433,6 +465,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &ReadCommand{
|
return &ReadCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -440,6 +473,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &SecretsCommand{
|
return &SecretsCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -447,6 +481,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &SecretsDisableCommand{
|
return &SecretsDisableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -454,6 +489,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &SecretsEnableCommand{
|
return &SecretsEnableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -461,6 +497,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &SecretsListCommand{
|
return &SecretsListCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -468,6 +505,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &SecretsMoveCommand{
|
return &SecretsMoveCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -475,6 +513,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &SecretsTuneCommand{
|
return &SecretsTuneCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -482,6 +521,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &ServerCommand{
|
return &ServerCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: serverCmdUi,
|
UI: serverCmdUi,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
AuditBackends: auditBackends,
|
AuditBackends: auditBackends,
|
||||||
CredentialBackends: credentialBackends,
|
CredentialBackends: credentialBackends,
|
||||||
@@ -495,6 +535,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &SSHCommand{
|
return &SSHCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -502,6 +543,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &StatusCommand{
|
return &StatusCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -509,6 +551,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &TokenCommand{
|
return &TokenCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -516,6 +559,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &TokenCreateCommand{
|
return &TokenCreateCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -523,6 +567,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &TokenCapabilitiesCommand{
|
return &TokenCapabilitiesCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -530,6 +575,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &TokenLookupCommand{
|
return &TokenLookupCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -537,6 +583,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &TokenRenewCommand{
|
return &TokenRenewCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -544,6 +591,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &TokenRevokeCommand{
|
return &TokenRevokeCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -551,6 +599,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &UnwrapCommand{
|
return &UnwrapCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -559,6 +608,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
VersionInfo: version.GetVersion(),
|
VersionInfo: version.GetVersion(),
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -566,6 +616,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &WriteCommand{
|
return &WriteCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -579,10 +630,10 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
return &DeprecatedCommand{
|
return &DeprecatedCommand{
|
||||||
Old: "audit-disable",
|
Old: "audit-disable",
|
||||||
New: "audit disable",
|
New: "audit disable",
|
||||||
UI: ui,
|
|
||||||
Command: &AuditDisableCommand{
|
Command: &AuditDisableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -596,6 +647,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &AuditEnableCommand{
|
Command: &AuditEnableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -609,6 +661,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &AuditListCommand{
|
Command: &AuditListCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -622,6 +675,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &AuthDisableCommand{
|
Command: &AuthDisableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -635,6 +689,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &AuthEnableCommand{
|
Command: &AuthEnableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -648,6 +703,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &TokenCapabilitiesCommand{
|
Command: &TokenCapabilitiesCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -661,6 +717,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &OperatorGenerateRootCommand{
|
Command: &OperatorGenerateRootCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -674,6 +731,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &OperatorInitCommand{
|
Command: &OperatorInitCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -687,6 +745,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &OperatorKeyStatusCommand{
|
Command: &OperatorKeyStatusCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -700,6 +759,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &LeaseRenewCommand{
|
Command: &LeaseRenewCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -713,6 +773,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &LeaseRevokeCommand{
|
Command: &LeaseRevokeCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -726,6 +787,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &SecretsEnableCommand{
|
Command: &SecretsEnableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -739,6 +801,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &SecretsTuneCommand{
|
Command: &SecretsTuneCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -752,6 +815,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &SecretsListCommand{
|
Command: &SecretsListCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -765,6 +829,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &PoliciesDeprecatedCommand{
|
Command: &PoliciesDeprecatedCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -778,6 +843,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &PolicyDeleteCommand{
|
Command: &PolicyDeleteCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -791,6 +857,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &PolicyWriteCommand{
|
Command: &PolicyWriteCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -804,6 +871,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &OperatorRekeyCommand{
|
Command: &OperatorRekeyCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -817,6 +885,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &SecretsMoveCommand{
|
Command: &SecretsMoveCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -830,6 +899,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &OperatorRotateCommand{
|
Command: &OperatorRotateCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -843,6 +913,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &OperatorSealCommand{
|
Command: &OperatorSealCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -856,6 +927,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &OperatorStepDownCommand{
|
Command: &OperatorStepDownCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -869,6 +941,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &TokenCreateCommand{
|
Command: &TokenCreateCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -882,6 +955,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &TokenLookupCommand{
|
Command: &TokenLookupCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -895,6 +969,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &TokenRenewCommand{
|
Command: &TokenRenewCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -908,6 +983,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &TokenRevokeCommand{
|
Command: &TokenRevokeCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -921,6 +997,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &SecretsDisableCommand{
|
Command: &SecretsDisableCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -934,6 +1011,7 @@ func initCommands(ui, serverCmdUi cli.Ui) {
|
|||||||
Command: &OperatorUnsealCommand{
|
Command: &OperatorUnsealCommand{
|
||||||
BaseCommand: &BaseCommand{
|
BaseCommand: &BaseCommand{
|
||||||
UI: ui,
|
UI: ui,
|
||||||
|
tokenHelper: baseCmdTemplate.tokenHelper,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
@@ -81,6 +81,16 @@ func setupEnv(args []string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Run(args []string) int {
|
func Run(args []string) int {
|
||||||
|
return RunCustom(args, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RunCustom allows passing in a base command template to pass to other
|
||||||
|
// commands. Currenty, this is only used for setting a custom token helper.
|
||||||
|
func RunCustom(args []string, baseCmdTemplate *BaseCommand) int {
|
||||||
|
if baseCmdTemplate == nil {
|
||||||
|
baseCmdTemplate = &BaseCommand{}
|
||||||
|
}
|
||||||
|
|
||||||
args = setupEnv(args)
|
args = setupEnv(args)
|
||||||
|
|
||||||
// Don't use color if disabled
|
// Don't use color if disabled
|
||||||
@@ -129,7 +139,7 @@ func Run(args []string) int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initCommands(ui, serverCmdUi)
|
initCommands(ui, serverCmdUi, baseCmdTemplate)
|
||||||
|
|
||||||
// Calculate hidden commands from the deprecated ones
|
// Calculate hidden commands from the deprecated ones
|
||||||
hiddenCommands := make([]string, 0, len(DeprecatedCommands)+1)
|
hiddenCommands := make([]string, 0, len(DeprecatedCommands)+1)
|
||||||
|
|||||||
Reference in New Issue
Block a user