cmd/certificates: ensure we can bind config values (#2779)
This commit is contained in:
parent
3a82b63974
commit
fec10ccbd5
@ -15,7 +15,8 @@ import (
|
||||
"storj.io/storj/pkg/server"
|
||||
)
|
||||
|
||||
type batchCfg struct {
|
||||
// BatchCfg defines configuration for batching
|
||||
type BatchCfg struct {
|
||||
EmailsPath string `help:"optional path to a list of emails, delimited by <delimiter>, for batch processing"`
|
||||
Delimiter string `help:"delimiter to split emails loaded from <emails-path> on (e.g. comma, new-line)" default:"\n"`
|
||||
}
|
||||
@ -33,7 +34,7 @@ var (
|
||||
}
|
||||
|
||||
config struct {
|
||||
batchCfg
|
||||
BatchCfg
|
||||
CA identity.CASetupConfig
|
||||
Identity identity.SetupConfig
|
||||
Server struct { // workaround server.Config change
|
||||
|
@ -138,7 +138,16 @@ func bindConfig(flags FlagSet, prefix string, val reflect.Value, vars map[string
|
||||
continue
|
||||
}
|
||||
|
||||
fieldaddr := fieldval.Addr().Interface()
|
||||
if !fieldval.CanAddr() {
|
||||
panic(fmt.Sprintf("cannot addr field %s in %s", field.Name, typ))
|
||||
}
|
||||
|
||||
fieldref := fieldval.Addr()
|
||||
if !fieldref.CanInterface() {
|
||||
panic(fmt.Sprintf("cannot get interface of field %s in %s", field.Name, typ))
|
||||
}
|
||||
|
||||
fieldaddr := fieldref.Interface()
|
||||
if fieldvalue, ok := fieldaddr.(pflag.Value); ok {
|
||||
help := field.Tag.Get("help")
|
||||
var def string
|
||||
|
Loading…
Reference in New Issue
Block a user