Skip to content

Commit 28c17fb

Browse files
committed
change hub backend address on push/pull
Signed-off-by: matewolf <[email protected]>
1 parent 0f81ddc commit 28c17fb

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

cli/cmd/hub/pull/pull.go

+6-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/spf13/cobra"
1111
"google.golang.org/grpc/metadata"
1212

13-
"github.com/agntcy/dir/cli/config"
1413
hubClient "github.com/agntcy/dir/cli/hub/client"
1514
"github.com/agntcy/dir/cli/hub/secretstore"
1615
contextUtils "github.com/agntcy/dir/cli/util/context"
@@ -62,7 +61,12 @@ func NewCommand() *cobra.Command {
6261
return fmt.Errorf("agent id is the only required argument")
6362
}
6463

65-
hc, err := hubClient.New(config.DefaultHubBackendAddress)
64+
secret, ok := contextUtils.GetCurrentHubSecretFromContext(cmd.Context())
65+
if !ok {
66+
return fmt.Errorf("could not get current hub secret from context")
67+
}
68+
69+
hc, err := hubClient.New(secret.HubBackendAddress)
6670
if err != nil {
6771
return fmt.Errorf("failed to create hub client: %w", err)
6872
}
@@ -72,11 +76,6 @@ func NewCommand() *cobra.Command {
7276
return fmt.Errorf("invalid agent id: %w", err)
7377
}
7478

75-
secret, ok := contextUtils.GetCurrentHubSecretFromContext(cmd.Context())
76-
if !ok {
77-
return fmt.Errorf("could not get current hub secret from context")
78-
}
79-
8079
return runCmd(cmd.Context(), hc, agentId, secret)
8180
},
8281
}

cli/cmd/hub/push/push.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/spf13/cobra"
1010
"google.golang.org/grpc/metadata"
1111

12-
"github.com/agntcy/dir/cli/config"
1312
hubClient "github.com/agntcy/dir/cli/hub/client"
1413
"github.com/agntcy/dir/cli/options"
1514
"github.com/agntcy/dir/cli/util/agent"
@@ -68,7 +67,7 @@ func NewCommand(hubOpts *options.HubOptions) *cobra.Command {
6867
return fmt.Errorf("You need to be logged in to push to the hub.\nUse `dirctl hub login` command to login.")
6968
}
7069

71-
hc, err := hubClient.New(config.DefaultHubBackendAddress)
70+
hc, err := hubClient.New(secret.HubBackendAddress)
7271
if err != nil {
7372
return fmt.Errorf("failed to create hub client: %w", err)
7473
}

0 commit comments

Comments
 (0)