Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-11-20 14:24:02 +03:00
parent 70f77a53d9
commit 00d16dbfd1
Signed by: fyrchik
SSH key fingerprint: SHA256:m/TTwCzjnRkXgnzEx9X92ccxy1CcVeinOgDb3NPWWmg

View file

@ -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))
}