more work done

This commit is contained in:
ston1th 2021-03-06 16:51:36 +01:00
commit 6fda229a8e
23 changed files with 384 additions and 177 deletions

View file

@ -7,12 +7,13 @@ import (
"io"
"io/ioutil"
"os"
"os/exec"
"sync"
"text/template"
)
type ServiceManager interface {
Reload()
Reload(context.Context) error
}
type HAProxyManager struct {
@ -25,7 +26,7 @@ type HAProxyManager struct {
}
func NewHAProxyManager(configFile string) (*HAProxyManager, error) {
t, err := template.New("haproxy").Parse(haproxyTemplate)
t, err := template.New("haproxy").Parse(haproxyConfigTemplate)
if err != nil {
return nil, err
}
@ -74,5 +75,5 @@ func (ha *HAProxyManager) UpdateConfig(ctx context.Context, lbs Config) error {
}
file.Close()
ha.hash = hash
return ha.serviceManager.Reload()
return ha.serviceManager.Reload(ctx)
}