mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-05-12 02:58:20 +00:00
wip 56
This commit is contained in:
parent
a9be6c1670
commit
10f592f161
1 changed files with 5 additions and 5 deletions
10
cmd/exec.go
10
cmd/exec.go
|
@ -45,16 +45,16 @@ func execAction(_ *cobra.Command, args []string) error {
|
||||||
|
|
||||||
client, err := util.GetClient(ctx)
|
client, err := util.GetClient(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating client: %w", err)
|
return fmt.Errorf("Creating client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
envVars, err := resolveEnvironmentSecrets(ctx, client)
|
envVars, err := resolveEnvironmentSecrets(ctx, client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("resolving secrets: %w", err)
|
return fmt.Errorf("Resolving secrets: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = client.Logout(ctx); err != nil {
|
if err = client.Logout(ctx); err != nil {
|
||||||
return fmt.Errorf("logging out client: %w", err)
|
return fmt.Errorf("Logging out client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
subCmd := exec.Command(args[0], args[1:]...)
|
subCmd := exec.Command(args[0], args[1:]...)
|
||||||
|
@ -64,7 +64,7 @@ func execAction(_ *cobra.Command, args []string) error {
|
||||||
subCmd.Env = envVars
|
subCmd.Env = envVars
|
||||||
|
|
||||||
if err = subCmd.Run(); err != nil {
|
if err = subCmd.Run(); err != nil {
|
||||||
return fmt.Errorf("running command: %w", err)
|
return fmt.Errorf("Running command: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -89,7 +89,7 @@ func resolveEnvironmentSecrets(ctx context.Context, client *api.Client) ([]strin
|
||||||
resourceId := strings.TrimPrefix(value, PassboltPrefix)
|
resourceId := strings.TrimPrefix(value, PassboltPrefix)
|
||||||
_, _, _, _, secret, _, err := helper.GetResource(ctx, client, resourceId)
|
_, _, _, _, secret, _, err := helper.GetResource(ctx, client, resourceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("getting resource: %w", err)
|
return nil, fmt.Errorf("Getting resource: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
envVars[i] = key + "=" + secret
|
envVars[i] = key + "=" + secret
|
||||||
|
|
Loading…
Add table
Reference in a new issue