load feature.yaml as soon as possible
This commit is contained in:
parent
f25fdecc3f
commit
2e91a82aa7
|
@ -66,10 +66,6 @@ func initConfig() {
|
||||||
csConfig = csconfig.NewDefaultConfig()
|
csConfig = csconfig.NewDefaultConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := csconfig.LoadFeatureFlagsFile(csConfig, log.StandardLogger()); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// recap of the enabled feature flags, because logging
|
// recap of the enabled feature flags, because logging
|
||||||
// was not enabled when we set them from envvars
|
// was not enabled when we set them from envvars
|
||||||
if fflist := csconfig.ListFeatureFlags(); fflist != "" {
|
if fflist := csconfig.ListFeatureFlags(); fflist != "" {
|
||||||
|
|
|
@ -260,10 +260,6 @@ func LoadConfig(cConfig *csconfig.Config) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := csconfig.LoadFeatureFlagsFile(cConfig, log.StandardLogger()); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// recap of the enabled feature flags, because logging
|
// recap of the enabled feature flags, because logging
|
||||||
// was not enabled when we set them from envvars
|
// was not enabled when we set them from envvars
|
||||||
if fflist := csconfig.ListFeatureFlags(); fflist != "" {
|
if fflist := csconfig.ListFeatureFlags(); fflist != "" {
|
||||||
|
|
|
@ -45,6 +45,10 @@ func (c *Config) LoadCrowdsec() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = LoadFeatureFlagsFile(c, log.StandardLogger()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if c.Crowdsec == nil {
|
if c.Crowdsec == nil {
|
||||||
log.Warning("crowdsec agent is disabled")
|
log.Warning("crowdsec agent is disabled")
|
||||||
c.DisableAgent = true
|
c.DisableAgent = true
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package csconfig
|
package csconfig
|
||||||
|
|
||||||
|
import (
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
/*cscli specific config, such as hub directory*/
|
/*cscli specific config, such as hub directory*/
|
||||||
type CscliCfg struct {
|
type CscliCfg struct {
|
||||||
Output string `yaml:"output,omitempty"`
|
Output string `yaml:"output,omitempty"`
|
||||||
|
@ -22,6 +26,9 @@ func (c *Config) LoadCSCLI() error {
|
||||||
if err := c.LoadConfigurationPaths(); err != nil {
|
if err := c.LoadConfigurationPaths(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := LoadFeatureFlagsFile(c, log.StandardLogger()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
c.Cscli.ConfigDir = c.ConfigPaths.ConfigDir
|
c.Cscli.ConfigDir = c.ConfigPaths.ConfigDir
|
||||||
c.Cscli.DataDir = c.ConfigPaths.DataDir
|
c.Cscli.DataDir = c.ConfigPaths.DataDir
|
||||||
c.Cscli.HubDir = c.ConfigPaths.HubDir
|
c.Cscli.HubDir = c.ConfigPaths.HubDir
|
||||||
|
|
Loading…
Reference in a new issue