Args
This commit is contained in:
parent
4232cccd75
commit
a9886eb80b
1 changed files with 15 additions and 10 deletions
19
traefik.go
19
traefik.go
|
@ -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()
|
||||||
|
currentConfiguration = new(Configuration)
|
||||||
|
log = logging.MustGetLogger("traefik")
|
||||||
|
templatesRenderer = render.New(render.Options{
|
||||||
Directory: "templates",
|
Directory: "templates",
|
||||||
Asset: Asset,
|
Asset: Asset,
|
||||||
AssetNames: AssetNames,
|
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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue