adjust konnectd
This commit is contained in:
@@ -33,7 +33,7 @@ func Execute() error {
|
|||||||
|
|
||||||
Before: func(c *cli.Context) error {
|
Before: func(c *cli.Context) error {
|
||||||
cfg.Service.Version = version.String
|
cfg.Service.Version = version.String
|
||||||
return ParseConfig(c, cfg)
|
return nil
|
||||||
},
|
},
|
||||||
|
|
||||||
Commands: []*cli.Command{
|
Commands: []*cli.Command{
|
||||||
@@ -88,22 +88,22 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
|||||||
switch err.(type) {
|
switch err.(type) {
|
||||||
case viper.ConfigFileNotFoundError:
|
case viper.ConfigFileNotFoundError:
|
||||||
logger.Info().
|
logger.Info().
|
||||||
Msg("Continue without config")
|
Msg("no config found on preconfigured location")
|
||||||
case viper.UnsupportedConfigError:
|
case viper.UnsupportedConfigError:
|
||||||
logger.Fatal().
|
logger.Fatal().
|
||||||
Err(err).
|
Err(err).
|
||||||
Msg("Unsupported config type")
|
Msg("unsupported config type")
|
||||||
default:
|
default:
|
||||||
logger.Fatal().
|
logger.Fatal().
|
||||||
Err(err).
|
Err(err).
|
||||||
Msg("Failed to read config")
|
Msg("failed to read config")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := viper.Unmarshal(&cfg); err != nil {
|
if err := viper.Unmarshal(&cfg); err != nil {
|
||||||
logger.Fatal().
|
logger.Fatal().
|
||||||
Err(err).
|
Err(err).
|
||||||
Msg("Failed to parse config")
|
Msg("failed to parse config")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -8,13 +8,6 @@ import (
|
|||||||
// RootWithConfig applies cfg to the root flagset
|
// RootWithConfig applies cfg to the root flagset
|
||||||
func RootWithConfig(cfg *config.Config) []cli.Flag {
|
func RootWithConfig(cfg *config.Config) []cli.Flag {
|
||||||
return []cli.Flag{
|
return []cli.Flag{
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "config-file",
|
|
||||||
Value: "",
|
|
||||||
Usage: "Path to config file",
|
|
||||||
EnvVars: []string{"KONNECTD_CONFIG_FILE"},
|
|
||||||
Destination: &cfg.File,
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "log-level",
|
Name: "log-level",
|
||||||
Value: "info",
|
Value: "info",
|
||||||
@@ -55,6 +48,13 @@ func HealthWithConfig(cfg *config.Config) []cli.Flag {
|
|||||||
// ServerWithConfig applies cfg to the root flagset
|
// ServerWithConfig applies cfg to the root flagset
|
||||||
func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||||
return []cli.Flag{
|
return []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "config-file",
|
||||||
|
Value: "",
|
||||||
|
Usage: "Path to config file",
|
||||||
|
EnvVars: []string{"KONNECTD_CONFIG_FILE"},
|
||||||
|
Destination: &cfg.File,
|
||||||
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "tracing-enabled",
|
Name: "tracing-enabled",
|
||||||
Usage: "Enable sending traces",
|
Usage: "Enable sending traces",
|
||||||
|
|||||||
Reference in New Issue
Block a user