mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-09 04:19:22 +00:00
⚡ Make the config
command print the current config instead of the default config
This commit is contained in:
parent
f2a384c8db
commit
5f9084e497
@ -17,13 +17,13 @@ var configCmd = &cobra.Command{
|
|||||||
Use: "config",
|
Use: "config",
|
||||||
Short: fmt.Sprintf("Generate %s config with default values", misc.Software),
|
Short: fmt.Sprintf("Generate %s config with default values", misc.Software),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
if config.Config.Config.Regenerate {
|
||||||
configWithDefaults, err := config.GetConfigWithDefaults()
|
configWithDefaults, err := config.GetConfigWithDefaults()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("Failed generating config with defaults.")
|
log.Error().Err(err).Msg("Failed generating config with defaults.")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.Config.Config.Regenerate {
|
|
||||||
if err := config.WriteConfig(configWithDefaults); err != nil {
|
if err := config.WriteConfig(configWithDefaults); err != nil {
|
||||||
log.Error().Err(err).Msg("Failed generating config with defaults.")
|
log.Error().Err(err).Msg("Failed generating config with defaults.")
|
||||||
return nil
|
return nil
|
||||||
@ -31,7 +31,7 @@ var configCmd = &cobra.Command{
|
|||||||
|
|
||||||
log.Info().Str("config-path", config.ConfigFilePath).Msg("Template file written to config path.")
|
log.Info().Str("config-path", config.ConfigFilePath).Msg("Template file written to config path.")
|
||||||
} else {
|
} else {
|
||||||
template, err := utils.PrettyYaml(configWithDefaults)
|
template, err := utils.PrettyYaml(config.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("Failed converting config with defaults to YAML.")
|
log.Error().Err(err).Msg("Failed converting config with defaults to YAML.")
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user