implemented api handlers
This commit is contained in:
parent
ab12dd67d4
commit
372915e24d
15 changed files with 302 additions and 73 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
|
@ -51,7 +52,11 @@ func (ha *HAProxyManager) checkConfig(ctx context.Context, lbs Config) (hash []b
|
|||
return
|
||||
}
|
||||
hash = h.Sum(nil)
|
||||
return hash, exec.CommandContext(ctx, "haproxy", "-c", "-f", tmp.Name()).Run()
|
||||
out, err := exec.CommandContext(ctx, "haproxy", "-c", "-f", tmp.Name()).CombinedOutput()
|
||||
if err != nil {
|
||||
err = fmt.Errorf("%s:%w", string(out), err)
|
||||
}
|
||||
return hash, err
|
||||
}
|
||||
|
||||
func (ha *HAProxyManager) UpdateConfig(ctx context.Context, lbs Config) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue