2017-04-13 20:48:32 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2017-05-03 20:01:05 +00:00
|
|
|
"log"
|
2017-04-13 20:48:32 +00:00
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/hashicorp/vault/plugins/database/mysql"
|
2022-09-06 18:00:37 +00:00
|
|
|
"github.com/hashicorp/vault/sdk/database/dbplugin/v5"
|
2017-04-13 20:48:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2020-10-22 21:43:19 +00:00
|
|
|
err := Run()
|
2017-04-13 20:48:32 +00:00
|
|
|
if err != nil {
|
2017-05-03 20:01:05 +00:00
|
|
|
log.Println(err)
|
2017-04-13 20:48:32 +00:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
2020-10-22 21:43:19 +00:00
|
|
|
|
|
|
|
// Run instantiates a MySQL object, and runs the RPC server for the plugin
|
|
|
|
func Run() error {
|
|
|
|
var f func() (interface{}, error)
|
2021-02-11 21:08:32 +00:00
|
|
|
f = mysql.New(mysql.DefaultUserNameTemplate)
|
2020-10-22 21:43:19 +00:00
|
|
|
|
2022-09-06 18:00:37 +00:00
|
|
|
dbplugin.ServeMultiplex(f)
|
2020-10-22 21:43:19 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|