fix(cli): hydrate shared configurations such as commons before running any service command

This commit is contained in:
Florian Schade
2025-12-12 12:43:47 +01:00
parent 9904e5b932
commit 5824d8df34

View File

@@ -272,20 +272,13 @@ func ServiceCommand(cfg *config.Config, serviceName string, subCommands []*cobra
Use: serviceName,
Short: fmt.Sprintf("%s service commands", serviceName),
GroupID: CommandGroupServices,
RunE: func(cmd *cobra.Command, args []string) error {
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
configlog.Error(parser.ParseConfig(cfg, true))
f(cfg)
return nil
},
}
// if a service should have multiple child commands,
// we expect that at least one argument is needed;
// this helps cobra to force display all available child commands.
if len(subCommands) > 0 {
command.Args = cobra.MinimumNArgs(1)
}
command.AddCommand(subCommands...)
return command