1package main
2
3import (
4	"os"
5
6	hclog "github.com/hashicorp/go-hclog"
7	couchbase "github.com/hashicorp/vault-plugin-database-couchbase"
8	dbplugin "github.com/hashicorp/vault/sdk/database/dbplugin/v5"
9)
10
11func main() {
12	err := Run()
13	if err != nil {
14		logger := hclog.New(&hclog.LoggerOptions{})
15
16		logger.Error("plugin shutting down", "error", err)
17		os.Exit(1)
18	}
19}
20
21// Run instantiates a CouchbaseDB object, and runs the RPC server for the plugin
22func Run() error {
23	db, err := couchbase.New()
24	if err != nil {
25		return err
26	}
27
28	dbplugin.Serve(db.(dbplugin.Database))
29
30	return nil
31}
32