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
|
||||
Endpoint string
|
||||
dockerClient *docker.Client
|
||||
Filename string
|
||||
Domain string
|
||||
}
|
||||
|
||||
|
@ -72,14 +73,14 @@ func (provider *DockerProvider) loadDockerConfig() *Configuration {
|
|||
templateObjects := struct {
|
||||
Containers []docker.Container
|
||||
Hosts map[string][]docker.Container
|
||||
Domain string
|
||||
Domain string
|
||||
}{
|
||||
containersInspected,
|
||||
hosts,
|
||||
provider.Domain,
|
||||
}
|
||||
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 {
|
||||
log.Println("Error reading file:", err)
|
||||
return nil
|
||||
|
|
|
@ -19,6 +19,7 @@ import (
|
|||
)
|
||||
|
||||
type FileConfiguration struct {
|
||||
Port string
|
||||
Docker *DockerProvider
|
||||
File *FileProvider
|
||||
Web *WebProvider
|
||||
|
@ -98,7 +99,7 @@ func main() {
|
|||
},
|
||||
|
||||
Server: &http.Server{
|
||||
Addr: ":8001",
|
||||
Addr: configuration.Port,
|
||||
Handler: configurationRouter,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
port = ":8001"
|
||||
|
||||
[docker]
|
||||
endpoint = "unix:///var/run/docker.sock"
|
||||
watch = true
|
||||
domain = "toto.fr"
|
||||
filename = "docker.tmpl"
|
||||
|
||||
[web]
|
||||
address = ":8010"
|
||||
|
|
Loading…
Reference in a new issue