Skip to content
Snippets Groups Projects
Commit 3e61e87d authored by ale's avatar ale
Browse files

Attempt to fix partial config parsing issue

Using a *yaml.Node does not work.
parent 455ca882
No related branches found
No related tags found
No related merge requests found
...@@ -16,5 +16,5 @@ type Database interface { ...@@ -16,5 +16,5 @@ type Database interface {
// Config is how users configure a database backend. // Config is how users configure a database backend.
type Config struct { type Config struct {
Type string `yaml:"type"` Type string `yaml:"type"`
Params *yaml.Node `yaml:"params"` Params yaml.Node `yaml:"params"`
} }
...@@ -98,9 +98,9 @@ func NewKeyLookupProxy(config *Config) (*KeyLookupProxy, error) { ...@@ -98,9 +98,9 @@ func NewKeyLookupProxy(config *Config) (*KeyLookupProxy, error) {
var db backend.Database var db backend.Database
switch config.Backend.Type { switch config.Backend.Type {
case "ldap": case "ldap":
db, err = ldapBE.New(config.Backend.Params) db, err = ldapBE.New(&config.Backend.Params)
case "sql": case "sql":
db, err = sqlBE.New(config.Backend.Params) db, err = sqlBE.New(&config.Backend.Params)
default: default:
err = errors.New("unknown backend type") err = errors.New("unknown backend type")
} }
......
...@@ -44,11 +44,10 @@ func withTestDB(t testing.TB, schema string) (func(), string) { ...@@ -44,11 +44,10 @@ func withTestDB(t testing.TB, schema string) (func(), string) {
}, dbPath }, dbPath
} }
func makeMapSlice(m map[string]interface{}) *yaml.Node { func makeMapSlice(m map[string]interface{}) (out yaml.Node) {
var out yaml.Node
d, _ := yaml.Marshal(m) d, _ := yaml.Marshal(m)
yaml.Unmarshal(d, &out) yaml.Unmarshal(d, &out) // nolint: errcheck
return &out return
} }
var ( var (
......
...@@ -106,9 +106,9 @@ func NewKeyStore(config *Config) (*KeyStore, error) { ...@@ -106,9 +106,9 @@ func NewKeyStore(config *Config) (*KeyStore, error) {
var err error var err error
switch config.Backend.Type { switch config.Backend.Type {
case "ldap": case "ldap":
db, err = ldapBE.New(config.Backend.Params) db, err = ldapBE.New(&config.Backend.Params)
case "sql": case "sql":
db, err = sqlBE.New(config.Backend.Params) db, err = sqlBE.New(&config.Backend.Params)
default: default:
err = errors.New("unknown backend type") err = errors.New("unknown backend type")
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment