open-vault/plugins/database/redshift/redshift-database-plugin/main.go

34 lines
689 B
Go

package main
import (
"log"
"os"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/plugins/database/redshift"
"github.com/hashicorp/vault/sdk/database/dbplugin"
)
func main() {
apiClientMeta := &api.PluginAPIClientMeta{}
flags := apiClientMeta.FlagSet()
flags.Parse(os.Args[1:])
if err := Run(apiClientMeta.GetTLSConfig()); err != nil {
log.Println(err)
os.Exit(1)
}
}
// Run instantiates a RedShift object, and runs the RPC server for the plugin
func Run(apiTLSConfig *api.TLSConfig) error {
dbType, err := redshift.New()
if err != nil {
return err
}
dbplugin.Serve(dbType.(dbplugin.Database), api.VaultPluginTLSProvider(apiTLSConfig))
return nil
}