Add debug tool to image

This commit is contained in:
Alex Kursell 2019-02-08 11:25:04 -05:00
parent 5c4854b537
commit 9534f8bc43
7 changed files with 412 additions and 1 deletions

View file

@ -22,6 +22,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
"github.com/tv42/httpunix"
@ -87,6 +88,21 @@ func NewPostStatusRequest(path, contentType string, data interface{}) (int, []by
return res.StatusCode, body, nil
}
// ReadNginxConf reads the nginx configuration file into a string
func ReadNginxConf() (string, error) {
confFile, err := os.Open("/etc/nginx/nginx.conf")
if err != nil {
return "", err
}
defer confFile.Close()
contents, err := ioutil.ReadAll(confFile)
if err != nil {
return "", err
}
return string(contents), nil
}
func buildUnixSocketClient() *http.Client {
u := &httpunix.Transport{
DialTimeout: 1 * time.Second,