forked from TrueCloudLab/frostfs-node
[#886] cli: Fix API flags
Bind API cobra flags(`ttl' and xhdr') to the Viper. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
6b1e6456ab
commit
4615ff1392
5 changed files with 11 additions and 2 deletions
|
@ -83,6 +83,7 @@ var containerCmd = &cobra.Command{
|
|||
// bind exactly that cmd's flags to
|
||||
// the viper before execution
|
||||
bindCommonFlags(cmd)
|
||||
bindAPIFlags(cmd)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ var netmapCmd = &cobra.Command{
|
|||
// bind exactly that cmd's flags to
|
||||
// the viper before execution
|
||||
bindCommonFlags(cmd)
|
||||
bindAPIFlags(cmd)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ var (
|
|||
// bind exactly that cmd's flags to
|
||||
// the viper before execution
|
||||
bindCommonFlags(cmd)
|
||||
bindAPIFlags(cmd)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ const (
|
|||
envPrefix = "NEOFS_CLI"
|
||||
)
|
||||
|
||||
const xHeadersFlag = "xhdr"
|
||||
|
||||
var xHeaders []string
|
||||
|
||||
// Global scope flags.
|
||||
|
@ -402,3 +400,10 @@ func bindCommonFlags(cmd *cobra.Command) {
|
|||
_ = viper.BindPFlag(rpc, ff.Lookup(rpc))
|
||||
_ = viper.BindPFlag(verbose, ff.Lookup(verbose))
|
||||
}
|
||||
|
||||
func bindAPIFlags(cmd *cobra.Command) {
|
||||
ff := cmd.Flags()
|
||||
|
||||
_ = viper.BindPFlag(ttl, ff.Lookup(ttl))
|
||||
_ = viper.BindPFlag(xHeadersKey, ff.Lookup(xHeadersKey))
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ var storagegroupCmd = &cobra.Command{
|
|||
// bind exactly that cmd's flags to
|
||||
// the viper before execution
|
||||
bindCommonFlags(cmd)
|
||||
bindAPIFlags(cmd)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue