diff options
Diffstat (limited to 'internal/config/flags.go')
-rw-r--r-- | internal/config/flags.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/internal/config/flags.go b/internal/config/flags.go index bb3f67732..ddc3c60de 100644 --- a/internal/config/flags.go +++ b/internal/config/flags.go @@ -26,7 +26,12 @@ import ( // AddGlobalFlags will attach global configuration flags to given cobra command, loading defaults from global config. func AddGlobalFlags(cmd *cobra.Command) { - Config(func(cfg *Configuration) { + global.AddGlobalFlags(cmd) +} + +// AddGlobalFlags will attach global configuration flags to given cobra command, loading defaults from State. +func (s *ConfigState) AddGlobalFlags(cmd *cobra.Command) { + s.Config(func(cfg *Configuration) { // General cmd.PersistentFlags().String(ApplicationNameFlag(), cfg.ApplicationName, fieldtag("ApplicationName", "usage")) cmd.PersistentFlags().String(LandingPageUserFlag(), cfg.LandingPageUser, fieldtag("LandingPageUser", "usage")) @@ -51,7 +56,12 @@ func AddGlobalFlags(cmd *cobra.Command) { // AddServerFlags will attach server configuration flags to given cobra command, loading defaults from global config. func AddServerFlags(cmd *cobra.Command) { - Config(func(cfg *Configuration) { + global.AddServerFlags(cmd) +} + +// AddServerFlags will attach server configuration flags to given cobra command, loading defaults from State. +func (s *ConfigState) AddServerFlags(cmd *cobra.Command) { + s.Config(func(cfg *Configuration) { // Router cmd.PersistentFlags().String(BindAddressFlag(), cfg.BindAddress, fieldtag("BindAddress", "usage")) cmd.PersistentFlags().Int(PortFlag(), cfg.Port, fieldtag("Port", "usage")) |