Skip to content

Commit

Permalink
fix adding the same pointer to the loop's variables instead of having…
Browse files Browse the repository at this point in the history
… one pointer for each secret's variables

fixes auth0#841
  • Loading branch information
Tenrys committed Sep 13, 2023
1 parent 04992d8 commit a38feb2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/cli/actions.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cli

import (
"encoding/json"
"errors"
"fmt"
"net/url"
Expand Down Expand Up @@ -271,7 +272,7 @@ func updateActionCmd(cli *cli) *cobra.Command {
"To update interactively, use `auth0 actions update` with no arguments.\n\n" +
"To update non-interactively, supply the action id, name, code, secrets and " +
"dependencies through the flags.",
Example: ` auth0 actions update <action-id>
Example: ` auth0 actions update <action-id>
auth0 actions update <action-id> --name myaction
auth0 actions update <action-id> --name myaction --code "$(cat path/to/code.js)"
auth0 actions update <action-id> --name myaction --code "$(cat path/to/code.js)" --dependency "lodash=4.0.0"
Expand Down Expand Up @@ -332,7 +333,11 @@ func updateActionCmd(cli *cli) *cobra.Command {
updatedAction.Dependencies = inputDependenciesToActionDependencies(inputs.Dependencies)
}
if len(inputs.Secrets) != 0 {
s, _ := json.MarshalIndent(inputs.Secrets, "", "\t")
fmt.Print(string(s))
updatedAction.Secrets = inputSecretsToActionSecrets(inputs.Secrets)
s2, _ := json.MarshalIndent(updatedAction.Secrets, "", "\t")
fmt.Print(string(s2))
}

if err = ansi.Waiting(func() error {
Expand Down Expand Up @@ -558,7 +563,9 @@ func inputDependenciesToActionDependencies(dependencies map[string]string) *[]ma
func inputSecretsToActionSecrets(secrets map[string]string) *[]management.ActionSecret {
actionSecrets := make([]management.ActionSecret, 0)

for name, value := range secrets {
for k, v := range secrets {
name := k
value := v
actionSecrets = append(actionSecrets, management.ActionSecret{
Name: &name,
Value: &value,
Expand Down

0 comments on commit a38feb2

Please sign in to comment.