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
|
||||
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...)
|
||||
|
@ -295,8 +295,8 @@ func NewTraefikConfiguration() *TraefikConfiguration {
|
|||
AccessLogsFile: "",
|
||||
TraefikLogsFile: "",
|
||||
LogLevel: "ERROR",
|
||||
EntryPoints: map[string]*EntryPoint{"http": &EntryPoint{Address: ":80"}},
|
||||
DefaultEntryPoints: []string{"http"},
|
||||
EntryPoints: map[string]*EntryPoint{},
|
||||
DefaultEntryPoints: []string{},
|
||||
ProvidersThrottleDuration: time.Duration(2 * time.Second),
|
||||
MaxIdleConnsPerHost: 200,
|
||||
},
|
||||
|
|
33
traefik.go
33
traefik.go
|
@ -36,19 +36,16 @@ Complete documentation is available at https://traefik.io`,
|
|||
|
||||
//version Command init
|
||||
versionCmd := &flaeg.Command{
|
||||
Name: "version",
|
||||
Description: `Print version`,
|
||||
Name: "version",
|
||||
Description: `Print version`,
|
||||
Config: struct{}{},
|
||||
DefaultPointersConfig: struct{}{},
|
||||
Run: func() error {
|
||||
fmtlog.Println(Version + " built on the " + BuildDate)
|
||||
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
|
||||
f := flaeg.New(traefikCmd, os.Args[1:])
|
||||
//add custom parsers
|
||||
|
@ -57,11 +54,31 @@ Complete documentation is available at https://traefik.io`,
|
|||
f.AddParser(reflect.TypeOf(provider.Namespaces{}), &provider.Namespaces{})
|
||||
//add version command
|
||||
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
|
||||
s.AddSource(f)
|
||||
s.AddSource(toml)
|
||||
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 {
|
||||
fmtlog.Println(err)
|
||||
os.Exit(-1)
|
||||
|
|
Loading…
Reference in a new issue