diff --git a/cmd/vault-plugin-secrets-ad/main.go b/cmd/vault-plugin-secrets-ad/main.go index cb81d5a..283aa34 100644 --- a/cmd/vault-plugin-secrets-ad/main.go +++ b/cmd/vault-plugin-secrets-ad/main.go @@ -16,7 +16,10 @@ import ( func main() { apiClientMeta := &api.PluginAPIClientMeta{} flags := apiClientMeta.FlagSet() - flags.Parse(os.Args[1:]) + + if err := flags.Parse(os.Args[1:]); err != nil { + fatal(err) + } tlsConfig := apiClientMeta.GetTLSConfig() tlsProviderFunc := api.VaultPluginTLSProvider(tlsConfig) @@ -28,9 +31,12 @@ func main() { TLSProviderFunc: tlsProviderFunc, }) if err != nil { - logger := hclog.New(&hclog.LoggerOptions{}) - - logger.Error("plugin shutting down", "error", err) - os.Exit(1) + fatal(err) } } + +func fatal(err error) { + logger := hclog.New(&hclog.LoggerOptions{}) + logger.Error("plugin shutting down", "error", err) + os.Exit(1) +}