From e044d4b5edaeeccdeb1a77694a2d5fec64228625 Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Fri, 20 Sep 2024 16:53:30 -0600 Subject: [PATCH] Changed from using multiple plugin paths to just one --- cmd/serve.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cmd/serve.go b/cmd/serve.go index ee54f6c..f7e4401 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -35,11 +35,6 @@ var serveCmd = &cobra.Command{ } } - // use config plugins if none supplied via CLI - if len(pluginPaths) <= 0 { - pluginPaths = append(pluginPaths, config.PluginDirs...) - } - // show config as JSON and generators if verbose if verbose { b, err := json.MarshalIndent(config, "", " ") @@ -60,15 +55,19 @@ var serveCmd = &cobra.Command{ Retries: config.Server.Jwks.Retries, }, GeneratorParams: generator.Params{ - Args: args, - PluginPaths: pluginPaths, + Args: args, + PluginPath: pluginPath, // Target: target, // NOTE: targets are set via HTTP requests (ex: curl http://configurator:3334/generate?target=dnsmasq) Verbose: verbose, }, } + + // start listening with the server err := server.Serve() if errors.Is(err, http.ErrServerClosed) { - fmt.Printf("Server closed.") + if verbose { + fmt.Printf("Server closed.") + } } else if err != nil { fmt.Errorf("failed to start server: %v", err) os.Exit(1) @@ -79,7 +78,7 @@ var serveCmd = &cobra.Command{ func init() { serveCmd.Flags().StringVar(&config.Server.Host, "host", config.Server.Host, "set the server host") serveCmd.Flags().IntVar(&config.Server.Port, "port", config.Server.Port, "set the server port") - serveCmd.Flags().StringSliceVar(&pluginPaths, "plugins", nil, "set the generator plugins directory path") + serveCmd.Flags().StringVar(&pluginPath, "plugin", "", "set the generator plugins directory path") serveCmd.Flags().StringVar(&config.Server.Jwks.Uri, "jwks-uri", config.Server.Jwks.Uri, "set the JWKS url to fetch public key") serveCmd.Flags().IntVar(&config.Server.Jwks.Retries, "jwks-fetch-retries", config.Server.Jwks.Retries, "set the JWKS fetch retry count") rootCmd.AddCommand(serveCmd)