Add Host cert ACME generation
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
f1c3d820f7
commit
5e01c0a7db
6 changed files with 182 additions and 52 deletions
21
server.go
21
server.go
|
@ -244,6 +244,7 @@ func (server *Server) listenConfigurations(stop chan bool) {
|
|||
log.Infof("Server configuration reloaded on %s", server.serverEntryPoints[newServerEntryPointName].httpServer.Addr)
|
||||
}
|
||||
server.currentConfigurations.Set(newConfigurations)
|
||||
server.postLoadConfig()
|
||||
} else {
|
||||
log.Error("Error loading new configuration, aborted ", err)
|
||||
}
|
||||
|
@ -251,6 +252,26 @@ func (server *Server) listenConfigurations(stop chan bool) {
|
|||
}
|
||||
}
|
||||
|
||||
func (server *Server) postLoadConfig() {
|
||||
if server.globalConfiguration.ACME != nil && server.globalConfiguration.ACME.OnHostRule {
|
||||
currentConfigurations := server.currentConfigurations.Get().(configs)
|
||||
for _, configuration := range currentConfigurations {
|
||||
for _, frontend := range configuration.Frontends {
|
||||
for _, route := range frontend.Routes {
|
||||
rules := Rules{}
|
||||
domains, err := rules.ParseDomains(route.Rule)
|
||||
if err != nil {
|
||||
log.Errorf("Error parsing domains: %v", err)
|
||||
} else {
|
||||
server.globalConfiguration.ACME.LoadCertificateForDomains(domains)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (server *Server) configureProviders() {
|
||||
// configure providers
|
||||
if server.globalConfiguration.Docker != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue