1
0
mirror of https://github.com/containous/traefik.git synced 2024-12-24 21:34:39 +03:00

Fixes following review

This commit is contained in:
emile 2016-01-23 17:41:56 +01:00
parent 8adadaa5d4
commit f1b62b45f4
No known key found for this signature in database
GPG Key ID: D808B4C167352E59
2 changed files with 13 additions and 8 deletions

View File

@ -1,16 +1,16 @@
package main package main
import ( import (
"errors"
"fmt"
fmtlog "log" fmtlog "log"
"strings"
"time" "time"
"fmt"
"github.com/emilevauge/traefik/provider" "github.com/emilevauge/traefik/provider"
"github.com/emilevauge/traefik/types" "github.com/emilevauge/traefik/types"
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/wendal/errors"
"strings"
) )
// GlobalConfiguration holds global configuration (with providers, etc.). // GlobalConfiguration holds global configuration (with providers, etc.).
@ -97,8 +97,7 @@ func LoadConfiguration() *GlobalConfiguration {
viper.AddConfigPath("/etc/traefik/") // path to look for the config file in viper.AddConfigPath("/etc/traefik/") // path to look for the config file in
viper.AddConfigPath("$HOME/.traefik/") // call multiple times to add many search paths viper.AddConfigPath("$HOME/.traefik/") // call multiple times to add many search paths
viper.AddConfigPath(".") // optionally look for config in the working directory viper.AddConfigPath(".") // optionally look for config in the working directory
err := viper.ReadInConfig() // Find and read the config file if err := viper.ReadInConfig(); err != nil {
if err != nil { // Handle errors reading the config file
fmtlog.Fatalf("Error reading file: %s", err) fmtlog.Fatalf("Error reading file: %s", err)
} }
if len(arguments.Certificates) > 0 { if len(arguments.Certificates) > 0 {
@ -131,8 +130,7 @@ func LoadConfiguration() *GlobalConfiguration {
if arguments.boltdb { if arguments.boltdb {
viper.Set("boltdb", arguments.Boltdb) viper.Set("boltdb", arguments.Boltdb)
} }
err = unmarshal(&configuration) if err := unmarshal(&configuration); err != nil {
if err != nil {
fmtlog.Fatalf("Error reading file: %s", err) fmtlog.Fatalf("Error reading file: %s", err)
} }

View File

@ -148,10 +148,17 @@ import:
ref: fca8c8854093a154ff1eb580aae10276ad6b1b5f ref: fca8c8854093a154ff1eb580aae10276ad6b1b5f
- package: github.com/spf13/cast - package: github.com/spf13/cast
ref: ee7b3e0353166ab1f3a605294ac8cd2b77953778 ref: ee7b3e0353166ab1f3a605294ac8cd2b77953778
- package: github.com/mitchellh/mapstructure
- package: github.com/spf13/jwalterweatherman
- package: github.com/spf13/pflag
- package: github.com/wendal/errors
- package: github.com/hashicorp/hcl
- package: github.com/kr/pretty
- package: github.com/magiconair/properties
- package: github.com/kr/text
- package: github.com/spf13/viper - package: github.com/spf13/viper
ref: a212099cbe6fbe8d07476bfda8d2d39b6ff8f325 ref: a212099cbe6fbe8d07476bfda8d2d39b6ff8f325
- package: github.com/spf13/cobra - package: github.com/spf13/cobra
subpackages: subpackages:
- /cobra - /cobra