update default value
This commit is contained in:
parent
1e27c2dabe
commit
1a0f347023
2 changed files with 28 additions and 11 deletions
|
@ -77,7 +77,7 @@ func (dep *DefaultEntryPoints) SetValue(val interface{}) {
|
||||||
|
|
||||||
// Type is type of the struct
|
// Type is type of the struct
|
||||||
func (dep *DefaultEntryPoints) Type() string {
|
func (dep *DefaultEntryPoints) Type() string {
|
||||||
return fmt.Sprint("defaultentrypoints²")
|
return fmt.Sprint("defaultentrypoints")
|
||||||
}
|
}
|
||||||
|
|
||||||
// EntryPoints holds entry points configuration of the reverse proxy (ip, port, TLS...)
|
// EntryPoints holds entry points configuration of the reverse proxy (ip, port, TLS...)
|
||||||
|
@ -295,8 +295,8 @@ func NewTraefikConfiguration() *TraefikConfiguration {
|
||||||
AccessLogsFile: "",
|
AccessLogsFile: "",
|
||||||
TraefikLogsFile: "",
|
TraefikLogsFile: "",
|
||||||
LogLevel: "ERROR",
|
LogLevel: "ERROR",
|
||||||
EntryPoints: map[string]*EntryPoint{"http": &EntryPoint{Address: ":80"}},
|
EntryPoints: map[string]*EntryPoint{},
|
||||||
DefaultEntryPoints: []string{"http"},
|
DefaultEntryPoints: []string{},
|
||||||
ProvidersThrottleDuration: time.Duration(2 * time.Second),
|
ProvidersThrottleDuration: time.Duration(2 * time.Second),
|
||||||
MaxIdleConnsPerHost: 200,
|
MaxIdleConnsPerHost: 200,
|
||||||
},
|
},
|
||||||
|
|
33
traefik.go
33
traefik.go
|
@ -36,19 +36,16 @@ Complete documentation is available at https://traefik.io`,
|
||||||
|
|
||||||
//version Command init
|
//version Command init
|
||||||
versionCmd := &flaeg.Command{
|
versionCmd := &flaeg.Command{
|
||||||
Name: "version",
|
Name: "version",
|
||||||
Description: `Print version`,
|
Description: `Print version`,
|
||||||
|
Config: struct{}{},
|
||||||
|
DefaultPointersConfig: struct{}{},
|
||||||
Run: func() error {
|
Run: func() error {
|
||||||
fmtlog.Println(Version + " built on the " + BuildDate)
|
fmtlog.Println(Version + " built on the " + BuildDate)
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
//staert init
|
|
||||||
s := staert.NewStaert(traefikCmd)
|
|
||||||
|
|
||||||
//init toml source
|
|
||||||
toml := staert.NewTomlSource("traefik", []string{traefikConfiguration.ConfigFile, "/etc/traefik/", "$HOME/.traefik/", "."})
|
|
||||||
//init flaeg source
|
//init flaeg source
|
||||||
f := flaeg.New(traefikCmd, os.Args[1:])
|
f := flaeg.New(traefikCmd, os.Args[1:])
|
||||||
//add custom parsers
|
//add custom parsers
|
||||||
|
@ -57,11 +54,31 @@ Complete documentation is available at https://traefik.io`,
|
||||||
f.AddParser(reflect.TypeOf(provider.Namespaces{}), &provider.Namespaces{})
|
f.AddParser(reflect.TypeOf(provider.Namespaces{}), &provider.Namespaces{})
|
||||||
//add version command
|
//add version command
|
||||||
f.AddCommand(versionCmd)
|
f.AddCommand(versionCmd)
|
||||||
|
if _, err := f.Parse(traefikCmd); err != nil {
|
||||||
|
fmtlog.Println(err)
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
//staert init
|
||||||
|
s := staert.NewStaert(traefikCmd)
|
||||||
|
//init toml source
|
||||||
|
toml := staert.NewTomlSource("traefik", []string{traefikConfiguration.ConfigFile, "/etc/traefik/", "$HOME/.traefik/", "."})
|
||||||
|
|
||||||
//add sources to staert
|
//add sources to staert
|
||||||
s.AddSource(f)
|
|
||||||
s.AddSource(toml)
|
s.AddSource(toml)
|
||||||
s.AddSource(f)
|
s.AddSource(f)
|
||||||
|
if _, err := s.GetConfig(); err != nil {
|
||||||
|
fmtlog.Println(err)
|
||||||
|
}
|
||||||
|
if traefikConfiguration.File != nil && len(traefikConfiguration.File.Filename) == 0 {
|
||||||
|
// no filename, setting to global config file
|
||||||
|
log.Debugf("ConfigFileUsed %s", toml.ConfigFileUsed())
|
||||||
|
traefikConfiguration.File.Filename = toml.ConfigFileUsed()
|
||||||
|
}
|
||||||
|
if len(traefikConfiguration.EntryPoints) == 0 {
|
||||||
|
traefikConfiguration.EntryPoints = map[string]*EntryPoint{"http": &EntryPoint{Address: ":80"}}
|
||||||
|
traefikConfiguration.DefaultEntryPoints = []string{"http"}
|
||||||
|
}
|
||||||
if err := s.Run(); err != nil {
|
if err := s.Run(); err != nil {
|
||||||
fmtlog.Println(err)
|
fmtlog.Println(err)
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
|
|
Loading…
Reference in a new issue