allow literal $
in plugin configuration (#2015)
This commit is contained in:
parent
47cc60bda9
commit
02be5f3618
|
@ -12,16 +12,18 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Masterminds/sprig/v3"
|
"github.com/Masterminds/sprig/v3"
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/csconfig"
|
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/models"
|
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/protobufs"
|
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/types"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
plugin "github.com/hashicorp/go-plugin"
|
plugin "github.com/hashicorp/go-plugin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"gopkg.in/tomb.v2"
|
"gopkg.in/tomb.v2"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
|
"github.com/crowdsecurity/crowdsec/pkg/csconfig"
|
||||||
|
"github.com/crowdsecurity/crowdsec/pkg/csstring"
|
||||||
|
"github.com/crowdsecurity/crowdsec/pkg/models"
|
||||||
|
"github.com/crowdsecurity/crowdsec/pkg/protobufs"
|
||||||
|
"github.com/crowdsecurity/crowdsec/pkg/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var pluginMutex sync.Mutex
|
var pluginMutex sync.Mutex
|
||||||
|
@ -254,7 +256,7 @@ func (pb *PluginBroker) loadPlugins(path string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
data = []byte(os.ExpandEnv(string(data)))
|
data = []byte(csstring.StrictExpand(string(data), os.LookupEnv))
|
||||||
_, err = pluginClient.Configure(context.Background(), &protobufs.Config{Config: data})
|
_, err = pluginClient.Configure(context.Background(), &protobufs.Config{Config: data})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "while configuring %s", pc.Name)
|
return errors.Wrapf(err, "while configuring %s", pc.Name)
|
||||||
|
|
Loading…
Reference in a new issue