-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance config.Namespace #4339
Enhance config.Namespace #4339
Conversation
libbeat/common/config.go
Outdated
@@ -327,33 +328,59 @@ func (f *flagOverwrite) Get() interface{} { | |||
return f.value | |||
} | |||
|
|||
func (ns *ConfigNamespace) Unpack(cfg *Config) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported method ConfigNamespace.Unpack should have comment or be unexported
I'm not 100% sure I fully understand what this feature is doing compare to before. What wasn't possible and what is possible now (or the other way around)? |
libbeat/common/config.go
Outdated
// Validate checks at most one sub-namespace being set. | ||
func (ns *ConfigNamespace) Validate() error { | ||
if len(ns.C) > 1 { | ||
return errors.New("more then one namespace configured") | ||
} | ||
return nil | ||
} | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this code be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ups, yes.
this was not possible before:
when unpacking this config, ConfigNamespace will raise an error, because it found |
3304169
to
5491ad9
Compare
libbeat/common/config.go
Outdated
func (ns *ConfigNamespace) Validate() error { | ||
if len(ns.C) > 1 { | ||
return errors.New("more then one namespace configured") | ||
func (ns *ConfigNamespace) Unpack(cfg *Config) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add here some docs on what is happening if more then 1 namespace is enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
libbeat/common/config.go
Outdated
func (ns *ConfigNamespace) Validate() error { | ||
if len(ns.C) > 1 { | ||
return errors.New("more then one namespace configured") | ||
func (ns *ConfigNamespace) Unpack(cfg *Config) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golint] reported by reviewdog 🐶
exported method ConfigNamespace.Unpack should have comment or be unexported
5491ad9
to
8cc6a01
Compare
@urso Build seems to be broken :-( |
when unpacking into config.Namespace, namespaces can be disabled via `enabled: false` now. For settings allowing exactly one configuration, this can be used by users to enabled/disable namespace without having to comment them out in the configuration file. example usage: ``` type Config struct { Output common.ConfigNamespace } ``` user can have at most one enabled: ``` output.namespace1: enabled: false output.namespace2: enabled: true ```
8cc6a01
to
6167cc8
Compare
when unpacking into config.Namespace, namespaces can be disabled
via
enabled: false
now. For settings allowing exactly one configuration, thiscan be used by users to enabled/disable namespace without having to comment
them out in the configuration file.
example usage:
user can have at most one enabled: