|
@@ -2,6 +2,7 @@ package main
|
2
|
2
|
|
3
|
3
|
import (
|
4
|
4
|
"fmt"
|
|
5
|
+ "github.com/csmith/dotege/certs"
|
5
|
6
|
"github.com/csmith/dotege/docker"
|
6
|
7
|
"github.com/csmith/dotege/model"
|
7
|
8
|
"github.com/docker/docker/client"
|
|
@@ -32,6 +33,7 @@ func monitorSignals() <-chan bool {
|
32
|
33
|
func main() {
|
33
|
34
|
config := zap.NewDevelopmentConfig()
|
34
|
35
|
config.DisableCaller = true
|
|
36
|
+ config.DisableStacktrace = true
|
35
|
37
|
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
|
36
|
38
|
config.OutputPaths = []string{"stdout"}
|
37
|
39
|
config.ErrorOutputPaths = []string{"stdout"}
|
|
@@ -51,6 +53,9 @@ func main() {
|
51
|
53
|
panic(err)
|
52
|
54
|
}
|
53
|
55
|
|
|
56
|
+ certMonitor := certs.NewCertificateManager(sugar)
|
|
57
|
+ certMonitor.AddDirectory("/certs/certs")
|
|
58
|
+
|
54
|
59
|
templateGenerator := NewTemplateGenerator(sugar)
|
55
|
60
|
templateGenerator.AddTemplate(model.TemplateConfig{
|
56
|
61
|
Source: "./templates/domains.txt.tpl",
|
|
@@ -94,15 +99,15 @@ func main() {
|
94
|
99
|
}
|
95
|
100
|
}
|
96
|
101
|
|
97
|
|
-func getHostnames(containers map[string]model.Container, config model.LabelConfig) (hostnames map[string]model.Hostname) {
|
98
|
|
- hostnames = make(map[string]model.Hostname)
|
|
102
|
+func getHostnames(containers map[string]model.Container, config model.LabelConfig) (hostnames map[string]*model.Hostname) {
|
|
103
|
+ hostnames = make(map[string]*model.Hostname)
|
99
|
104
|
for _, container := range containers {
|
100
|
105
|
if label, ok := container.Labels[config.Hostnames]; ok {
|
101
|
106
|
names := strings.Split(strings.Replace(label, ",", " ", -1), " ")
|
102
|
107
|
if hostname, ok := hostnames[names[0]]; ok {
|
103
|
108
|
hostname.Containers = append(hostname.Containers, container)
|
104
|
109
|
} else {
|
105
|
|
- hostnames[names[0]] = model.Hostname{
|
|
110
|
+ hostnames[names[0]] = &model.Hostname{
|
106
|
111
|
Name: names[0],
|
107
|
112
|
Alternatives: make(map[string]bool),
|
108
|
113
|
Containers: []model.Container{container},
|
|
@@ -114,7 +119,7 @@ func getHostnames(containers map[string]model.Container, config model.LabelConfi
|
114
|
119
|
return
|
115
|
120
|
}
|
116
|
121
|
|
117
|
|
-func addAlternatives(hostname model.Hostname, alternatives []string) {
|
|
122
|
+func addAlternatives(hostname *model.Hostname, alternatives []string) {
|
118
|
123
|
for _, alternative := range alternatives {
|
119
|
124
|
hostname.Alternatives[alternative] = true
|
120
|
125
|
}
|