Added configurations
This commit is contained in:
parent
6f8f3e449d
commit
4a96f19221
3 changed files with 8 additions and 3 deletions
|
@ -34,6 +34,7 @@ type DockerProvider struct {
|
||||||
Watch bool
|
Watch bool
|
||||||
Endpoint string
|
Endpoint string
|
||||||
dockerClient *docker.Client
|
dockerClient *docker.Client
|
||||||
|
Filename string
|
||||||
Domain string
|
Domain string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,14 +73,14 @@ func (provider *DockerProvider) loadDockerConfig() *Configuration {
|
||||||
templateObjects := struct {
|
templateObjects := struct {
|
||||||
Containers []docker.Container
|
Containers []docker.Container
|
||||||
Hosts map[string][]docker.Container
|
Hosts map[string][]docker.Container
|
||||||
Domain string
|
Domain string
|
||||||
}{
|
}{
|
||||||
containersInspected,
|
containersInspected,
|
||||||
hosts,
|
hosts,
|
||||||
provider.Domain,
|
provider.Domain,
|
||||||
}
|
}
|
||||||
gtf.Inject(DockerFuncMap)
|
gtf.Inject(DockerFuncMap)
|
||||||
tmpl, err := template.New("docker.tmpl").Funcs(DockerFuncMap).ParseFiles("docker.tmpl")
|
tmpl, err := template.New(provider.Filename).Funcs(DockerFuncMap).ParseFiles(provider.Filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error reading file:", err)
|
log.Println("Error reading file:", err)
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -19,6 +19,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type FileConfiguration struct {
|
type FileConfiguration struct {
|
||||||
|
Port string
|
||||||
Docker *DockerProvider
|
Docker *DockerProvider
|
||||||
File *FileProvider
|
File *FileProvider
|
||||||
Web *WebProvider
|
Web *WebProvider
|
||||||
|
@ -98,7 +99,7 @@ func main() {
|
||||||
},
|
},
|
||||||
|
|
||||||
Server: &http.Server{
|
Server: &http.Server{
|
||||||
Addr: ":8001",
|
Addr: configuration.Port,
|
||||||
Handler: configurationRouter,
|
Handler: configurationRouter,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
|
port = ":8001"
|
||||||
|
|
||||||
[docker]
|
[docker]
|
||||||
endpoint = "unix:///var/run/docker.sock"
|
endpoint = "unix:///var/run/docker.sock"
|
||||||
watch = true
|
watch = true
|
||||||
domain = "toto.fr"
|
domain = "toto.fr"
|
||||||
|
filename = "docker.tmpl"
|
||||||
|
|
||||||
[web]
|
[web]
|
||||||
address = ":8010"
|
address = ":8010"
|
||||||
|
|
Loading…
Reference in a new issue