-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
main.go
40 lines (32 loc) · 840 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
36
37
38
39
40
// Package main can be used to build the Vault GitHub secrets plugin.
package main
import (
"os"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/sdk/plugin"
"github.com/martinbaillie/vault-plugin-secrets-github/github"
)
func main() {
apiClientMeta := &api.PluginAPIClientMeta{}
flags := apiClientMeta.FlagSet()
if err := flags.Parse(os.Args[1:]); err != nil {
fatalErr(err)
}
tlsConfig := apiClientMeta.GetTLSConfig()
tlsProviderFunc := api.VaultPluginTLSProvider(tlsConfig)
if err := plugin.ServeMultiplex(&plugin.ServeOpts{
BackendFactoryFunc: github.Factory,
TLSProviderFunc: tlsProviderFunc,
}); err != nil {
fatalErr(err)
}
}
func fatalErr(err error) {
hclog.New(&hclog.LoggerOptions{}).Error(
"plugin shutting down",
"error",
err,
)
os.Exit(1)
}