diff --git a/cmd/frostfs-adm/internal/commonflags/rpc.go b/cmd/frostfs-adm/internal/commonflags/rpc.go new file mode 100644 index 000000000..6f02e0b47 --- /dev/null +++ b/cmd/frostfs-adm/internal/commonflags/rpc.go @@ -0,0 +1,21 @@ +package commonflags + +import ( + "github.com/spf13/pflag" + "github.com/spf13/viper" +) + +// InitRPC inits common flags for storage node services. +func InitRPC(ff *pflag.FlagSet) { + ff.StringP(EndpointFlag, EndpointFlagShort, "", EndpointFlagDesc) + ff.String(ProtoConfigPath, "", "Path to the consensus node configuration") + ff.String(LocalDumpFlag, "", "Path to the blocks dump file") +} + +// BindRPC binds API flags of storage node services to the viper. +func BindRPC(ff *pflag.FlagSet) { + // LocalDumpFlag is left unbind intentionally: + // it serves as an explicit signal to use local dump instead of a remote RPC. + _ = viper.BindPFlag(EndpointFlag, ff.Lookup(EndpointFlag)) + _ = viper.BindPFlag(ProtoConfigPath, ff.Lookup(ProtoConfigPath)) +}