Skip to content

Commit

Permalink
add plugin dir param to client and control for restart and add node
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemadero committed Jan 6, 2023
1 parent 77f3873 commit 94e5cde
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ func (c *client) AddNode(ctx context.Context, name string, execPath string, opts
SubnetConfigs: ret.subnetConfigs,
}

if ret.pluginDir != "" {
req.PluginDir = &ret.pluginDir
}

c.log.Info("add node", zap.String("name", name))
return c.controlc.AddNode(ctx, req)
}
Expand All @@ -255,6 +259,9 @@ func (c *client) RestartNode(ctx context.Context, name string, opts ...OpOption)
if ret.execPath != "" {
req.ExecPath = &ret.execPath
}
if ret.pluginDir != "" {
req.PluginDir = &ret.pluginDir
}
if ret.whitelistedSubnets != "" {
req.WhitelistedSubnets = &ret.whitelistedSubnets
}
Expand Down
17 changes: 16 additions & 1 deletion cmd/control/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,12 @@ func newAddNodeCommand() *cobra.Command {
"",
"node config as string",
)
cmd.PersistentFlags().StringVar(
&pluginDir,
"plugin-dir",
"",
"[optional] plugin directory",
)
cmd.PersistentFlags().StringVar(
&chainConfigs,
"chain-configs",
Expand Down Expand Up @@ -571,7 +577,9 @@ func addNodeFunc(_ *cobra.Command, args []string) error {
}
defer cli.Close()

opts := []client.OpOption{}
opts := []client.OpOption{
client.WithPluginDir(pluginDir),
}

if addNodeConfig != "" {
ux.Print(log, logging.Yellow.Wrap("WARNING: overriding node configs with custom provided config %s"), addNodeConfig)
Expand Down Expand Up @@ -640,6 +648,12 @@ func newRestartNodeCommand() *cobra.Command {
"",
"whitelisted subnets (comma-separated)",
)
cmd.PersistentFlags().StringVar(
&pluginDir,
"plugin-dir",
"",
"[optional] plugin directory",
)
cmd.PersistentFlags().StringVar(
&chainConfigs,
"chain-configs",
Expand Down Expand Up @@ -672,6 +686,7 @@ func restartNodeFunc(_ *cobra.Command, args []string) error {

opts := []client.OpOption{
client.WithExecPath(avalancheGoBinPath),
client.WithPluginDir(pluginDir),
client.WithWhitelistedSubnets(whitelistedSubnets),
}

Expand Down

0 comments on commit 94e5cde

Please sign in to comment.