fix config default flag
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
config.y?ml
|
||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ClientsConfig struct {
|
type ClientsConfig struct {
|
||||||
LogLevel string `json:"logLevel" yaml:"logLevel" env:"LOG_LEVEL" envDefault:"warn"`
|
LogLevel string `json:"logLevel" yaml:"logLevel" env:"LOG_LEVEL" default:"warn"`
|
||||||
LogFormat string `json:"logFormat" yaml:"logFormat" env:"LOG_FORMAT" envDefault:"console"`
|
LogFormat string `json:"logFormat" yaml:"logFormat" env:"LOG_FORMAT" default:"console"`
|
||||||
|
|
||||||
Clients []ClientConfig `json:"clients" yaml:"clients" envPrefix:"CLIENT_"`
|
Clients []ClientConfig `json:"clients" yaml:"clients" envPrefix:"CLIENT_"`
|
||||||
}
|
}
|
||||||
@@ -19,19 +19,19 @@ type ClientsConfig struct {
|
|||||||
type ClientType string
|
type ClientType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
TypeEdgeOS ClientType = "edgeOS"
|
TypeEdgeOS ClientType = "edgeos"
|
||||||
TypeToughSwitch ClientType = "toughSwitch"
|
TypeToughSwitch ClientType = "toughswitch"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ClientConfig struct {
|
type ClientConfig struct {
|
||||||
Type ClientType `json:"type" yaml:"type" env:"TYPE"`
|
Type ClientType `json:"type" yaml:"type" env:"TYPE"`
|
||||||
Name string `json:"name" yaml:"name" env:"NAME"`
|
Name string `json:"name" yaml:"name" env:"NAME"`
|
||||||
Host string `json:"host" yaml:"host" env:"HOST"`
|
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"`
|
User string `json:"user" yaml:"user" env:"USER"`
|
||||||
Pass string `json:"pass" yaml:"pass" env:"PASS"`
|
Pass string `json:"pass" yaml:"pass" env:"PASS"`
|
||||||
Insecure bool `json:"insecure" yaml:"insecure" env:"INSECURE" envDefault:"false"`
|
Insecure bool `json:"insecure" yaml:"insecure" env:"INSECURE" default:"false"`
|
||||||
Timeout time.Duration `json:"timeout" yaml:"timeout" env:"TIMEOUT" envDefault:"10s"`
|
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
|
// LoadConfig will load a file if given, layering env on-top of the config
|
||||||
|
|||||||
Reference in New Issue
Block a user