fix config default flag

This commit is contained in:
2026-01-17 17:10:58 -05:00
parent edc86feccd
commit 868ab64bc9
2 changed files with 8 additions and 7 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
config.y?ml

View File

@@ -10,8 +10,8 @@ import (
)
type ClientsConfig struct {
LogLevel string `json:"logLevel" yaml:"logLevel" env:"LOG_LEVEL" envDefault:"warn"`
LogFormat string `json:"logFormat" yaml:"logFormat" env:"LOG_FORMAT" envDefault:"console"`
LogLevel string `json:"logLevel" yaml:"logLevel" env:"LOG_LEVEL" default:"warn"`
LogFormat string `json:"logFormat" yaml:"logFormat" env:"LOG_FORMAT" default:"console"`
Clients []ClientConfig `json:"clients" yaml:"clients" envPrefix:"CLIENT_"`
}
@@ -19,19 +19,19 @@ type ClientsConfig struct {
type ClientType string
const (
TypeEdgeOS ClientType = "edgeOS"
TypeToughSwitch ClientType = "toughSwitch"
TypeEdgeOS ClientType = "edgeos"
TypeToughSwitch ClientType = "toughswitch"
)
type ClientConfig struct {
Type ClientType `json:"type" yaml:"type" env:"TYPE"`
Name string `json:"name" yaml:"name" env:"NAME"`
Host string `json:"host" yaml:"host" env:"HOST"`
Scheme string `json:"scheme" yaml:"scheme" env:"SCHEME" envDefault:"https"`
Scheme string `json:"scheme" yaml:"scheme" env:"SCHEME" default:"https"`
User string `json:"user" yaml:"user" env:"USER"`
Pass string `json:"pass" yaml:"pass" env:"PASS"`
Insecure bool `json:"insecure" yaml:"insecure" env:"INSECURE" envDefault:"false"`
Timeout time.Duration `json:"timeout" yaml:"timeout" env:"TIMEOUT" envDefault:"10s"`
Insecure bool `json:"insecure" yaml:"insecure" env:"INSECURE" default:"false"`
Timeout time.Duration `json:"timeout" yaml:"timeout" env:"TIMEOUT" default:"10s"`
}
// LoadConfig will load a file if given, layering env on-top of the config