forked from jetbrains-infra/vault-plugin-secrets-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
35 lines (28 loc) · 792 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/vault/sdk/plugin"
"github.com/jetbrains-infra/vault-plugin-secrets-kubernetes/backend"
"log"
"os"
"github.com/hashicorp/vault/api"
)
func main() {
apiClientMeta := &api.PluginAPIClientMeta{}
flags := apiClientMeta.FlagSet()
err := flags.Parse(os.Args[1:])
if err != nil {
log.Fatalf("Unable to parse arguments %+v, %s", os.Args[1:], err)
}
tlsConfig := apiClientMeta.GetTLSConfig()
tlsProviderFunc := api.VaultPluginTLSProvider(tlsConfig)
err = plugin.Serve(&plugin.ServeOpts{
BackendFactoryFunc: backend.Factory,
TLSProviderFunc: tlsProviderFunc,
})
if err != nil {
logger := hclog.New(&hclog.LoggerOptions{})
logger.Error("plugin shutting down", "error", err)
os.Exit(1)
}
}