This commit is contained in:
emile 2015-09-12 01:55:10 +02:00
parent 4232cccd75
commit a9886eb80b

View file

@ -16,17 +16,23 @@ import (
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
"github.com/gorilla/handlers" "github.com/gorilla/handlers"
"github.com/unrolled/render" "github.com/unrolled/render"
"gopkg.in/alecthomas/kingpin.v2"
) )
var currentConfiguration = new(Configuration)
var log = logging.MustGetLogger("traefik") var (
var templatesRenderer = render.New(render.Options{ globalConfigFile = kingpin.Arg("conf", "Main configration file.").Default("traefik.toml").String()
Directory: "templates", currentConfiguration = new(Configuration)
Asset: Asset, log = logging.MustGetLogger("traefik")
AssetNames: AssetNames, templatesRenderer = render.New(render.Options{
}) Directory: "templates",
Asset: Asset,
AssetNames: AssetNames,
})
)
func main() { func main() {
kingpin.Parse()
var srv *graceful.Server var srv *graceful.Server
var configurationRouter *mux.Router var configurationRouter *mux.Router
var configurationChan = make(chan *Configuration) var configurationChan = make(chan *Configuration)
@ -36,8 +42,7 @@ func main() {
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
// load global configuration // load global configuration
globalConfigFile := "traefik.toml" gloablConfiguration := LoadFileConfig(*globalConfigFile)
gloablConfiguration := LoadFileConfig(globalConfigFile)
// logging // logging
backends := []logging.Backend{} backends := []logging.Backend{}
@ -98,7 +103,7 @@ func main() {
if (gloablConfiguration.File != nil) { if (gloablConfiguration.File != nil) {
if (len(gloablConfiguration.File.Filename) == 0) { if (len(gloablConfiguration.File.Filename) == 0) {
// no filename, setting to global config file // no filename, setting to global config file
gloablConfiguration.File.Filename = globalConfigFile gloablConfiguration.File.Filename = *globalConfigFile
} }
providers = append(providers, gloablConfiguration.File) providers = append(providers, gloablConfiguration.File)
} }