From 00d16dbfd17039a920a2f5ff76640005577d8874 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 20 Nov 2024 14:24:02 +0300 Subject: [PATCH] m Signed-off-by: Evgenii Stratonikov --- cmd/frostfs-adm/internal/commonflags/rpc.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 cmd/frostfs-adm/internal/commonflags/rpc.go 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)) +}