Skip to content
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

fix(config): do not overwirte sink yaml config by environment #1479

Merged
merged 3 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/conf/yaml_config_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func NewConfigOperatorFromSourceYaml(pluginName string) (ConfigOperator, error)
fileName = pluginName

filePath = path.Join(dir, fileName+`.yaml`)
_ = LoadConfigFromPath(filePath, &c.dataCfg)
_ = filex.ReadYamlUnmarshal(filePath, &c.dataCfg)

return c, nil
}
Expand Down Expand Up @@ -402,7 +402,7 @@ func NewConfigOperatorFromSinkYaml(pluginName string) (ConfigOperator, error) {
dir := path.Join(dataDir, "sinks")

filePath := path.Join(dir, pluginName+`.yaml`)
_ = LoadConfigFromPath(filePath, &c.dataCfg)
_ = filex.ReadYamlUnmarshal(filePath, &c.dataCfg)

return c, nil
}
Expand Down Expand Up @@ -463,7 +463,7 @@ func NewConfigOperatorFromConnectionYaml(pluginName string) (ConfigOperator, err
}
yamlPath = path.Join(confDir, "connections/connection.yaml")
yamlData = make(map[string]interface{})
_ = LoadConfigFromPath(yamlPath, &yamlData)
_ = filex.ReadYamlUnmarshal(yamlPath, &yamlData)

if plgCnfs, ok := yamlData[pluginName]; ok {
if cf, ok1 := plgCnfs.(map[string]interface{}); ok1 {
Expand Down
10 changes: 5 additions & 5 deletions internal/topo/node/conf/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ func GetSourceConf(sourceType string, options *ast.Options) map[string]interface
} else {
def, ok := cfg["default"]
if !ok {
conf.Log.Warnf("default conf %s is not found", confkey)
conf.Log.Warnf("default config_key not found")
} else {
props = def
if c, ok := cfg[strings.ToLower(confkey)]; ok {
for k, v := range c {
props[k] = v
}
}
if c, ok := cfg[strings.ToLower(confkey)]; ok {
for k, v := range c {
props[k] = v
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions internal/topo/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/lf-edge/ekuiper/internal/topo/node/metric"
"github.com/lf-edge/ekuiper/internal/xsql"
"github.com/lf-edge/ekuiper/pkg/api"
"github.com/lf-edge/ekuiper/pkg/ast"
)

type OperatorNode interface {
Expand Down Expand Up @@ -189,15 +188,16 @@ func SinkOpen(sinkType string, config map[string]interface{}) error {
}

func SourceOpen(sourceType string, config map[string]interface{}) error {

options := &ast.Options{}
//_ = nodeConf.GetSourceConf(sourceType, options)
dataSource := "testSource"
if v, ok := config["DATASOURCE"]; ok {
dataSource = v.(string)
}

ns, err := io.Source(sourceType)
if err != nil {
return err
}
err = ns.Configure(options.DATASOURCE, config)
err = ns.Configure(dataSource, config)
if err != nil {
return err
}
Expand Down