open-vault/builtin/logical/totp/cmd/totp/main.go

30 lines
674 B
Go
Raw Normal View History

package main
import (
"os"
hclog "github.com/hashicorp/go-hclog"
2019-04-13 02:01:13 +00:00
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/builtin/logical/totp"
"github.com/hashicorp/vault/sdk/plugin"
)
func main() {
2019-04-15 18:10:07 +00:00
apiClientMeta := &api.PluginAPIClientMeta{}
flags := apiClientMeta.FlagSet()
flags.Parse(os.Args[1:])
tlsConfig := apiClientMeta.GetTLSConfig()
tlsProviderFunc := api.VaultPluginTLSProvider(tlsConfig)
if err := plugin.Serve(&plugin.ServeOpts{
BackendFactoryFunc: totp.Factory,
TLSProviderFunc: tlsProviderFunc,
}); err != nil {
logger := hclog.New(&hclog.LoggerOptions{})
logger.Error("plugin shutting down", "error", err)
os.Exit(1)
}
}