Changed from using multiple plugin paths to just one
This commit is contained in:
parent
b488c32195
commit
e044d4b5ed
1 changed files with 8 additions and 9 deletions
17
cmd/serve.go
17
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
|
// show config as JSON and generators if verbose
|
||||||
if verbose {
|
if verbose {
|
||||||
b, err := json.MarshalIndent(config, "", " ")
|
b, err := json.MarshalIndent(config, "", " ")
|
||||||
|
|
@ -60,15 +55,19 @@ var serveCmd = &cobra.Command{
|
||||||
Retries: config.Server.Jwks.Retries,
|
Retries: config.Server.Jwks.Retries,
|
||||||
},
|
},
|
||||||
GeneratorParams: generator.Params{
|
GeneratorParams: generator.Params{
|
||||||
Args: args,
|
Args: args,
|
||||||
PluginPaths: pluginPaths,
|
PluginPath: pluginPath,
|
||||||
// Target: target, // NOTE: targets are set via HTTP requests (ex: curl http://configurator:3334/generate?target=dnsmasq)
|
// Target: target, // NOTE: targets are set via HTTP requests (ex: curl http://configurator:3334/generate?target=dnsmasq)
|
||||||
Verbose: verbose,
|
Verbose: verbose,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// start listening with the server
|
||||||
err := server.Serve()
|
err := server.Serve()
|
||||||
if errors.Is(err, http.ErrServerClosed) {
|
if errors.Is(err, http.ErrServerClosed) {
|
||||||
fmt.Printf("Server closed.")
|
if verbose {
|
||||||
|
fmt.Printf("Server closed.")
|
||||||
|
}
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
fmt.Errorf("failed to start server: %v", err)
|
fmt.Errorf("failed to start server: %v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
@ -79,7 +78,7 @@ var serveCmd = &cobra.Command{
|
||||||
func init() {
|
func init() {
|
||||||
serveCmd.Flags().StringVar(&config.Server.Host, "host", config.Server.Host, "set the server host")
|
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().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().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")
|
serveCmd.Flags().IntVar(&config.Server.Jwks.Retries, "jwks-fetch-retries", config.Server.Jwks.Retries, "set the JWKS fetch retry count")
|
||||||
rootCmd.AddCommand(serveCmd)
|
rootCmd.AddCommand(serveCmd)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue