diff --git a/cmd/generate.go b/cmd/generate.go index 44e4e5d..578c9f0 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -81,6 +81,7 @@ var generateCmd = &cobra.Command{ } // set the client options + // params.ClientOpts = append(params.ClientOpts, client.WithHost(remoteHost)) if conf.AccessToken != "" { params.ClientOpts = append(params.ClientOpts, client.WithAccessToken(conf.AccessToken)) } @@ -89,7 +90,7 @@ var generateCmd = &cobra.Command{ } // run generator.Generate() with just plugin path and templates provided - outputBytes, err := generator.Generate(pluginPath, params) + outputBytes, err := generator.Generate(&conf, pluginPath, params) if err != nil { log.Error().Err(err).Msg("failed to generate files") } diff --git a/cmd/root.go b/cmd/root.go index 1d1997c..583ee6c 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -40,13 +40,13 @@ func Execute() { } func init() { - cobra.OnInitialize(initConfig) + cobra.OnInitialize(InitConfig) rootCmd.PersistentFlags().StringVarP(&configPath, "config", "c", "", "set the config path") rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "set to enable verbose output") rootCmd.PersistentFlags().StringVar(&cacertPath, "cacert", "", "path to CA cert. (defaults to system CAs)") } -func initConfig() { +func InitConfig() { // empty from not being set if configPath != "" { exists, err := util.PathExists(configPath)