open-vault/helper/builtinplugins/builtin.go

33 lines
673 B
Go
Raw Normal View History

package builtinplugins
2017-04-06 00:19:29 +00:00
import (
2017-04-26 17:34:45 +00:00
"github.com/hashicorp/vault/plugins/database/mssql"
2017-04-13 20:48:32 +00:00
"github.com/hashicorp/vault/plugins/database/mysql"
"github.com/hashicorp/vault/plugins/database/postgresql"
2017-04-06 00:19:29 +00:00
)
type BuiltinFactory func() (interface{}, error)
var plugins map[string]BuiltinFactory = map[string]BuiltinFactory{
"mysql-database-plugin": mysql.New,
"postgresql-database-plugin": postgresql.New,
2017-04-26 17:34:45 +00:00
"mssql-database-plugin": mssql.New,
2017-04-07 22:50:03 +00:00
}
func Get(name string) (BuiltinFactory, bool) {
f, ok := plugins[name]
2017-04-07 22:50:03 +00:00
return f, ok
}
func Keys() []string {
keys := make([]string, len(plugins))
i := 0
for k := range plugins {
keys[i] = k
i++
}
return keys
}