bug fix and auto detect nginx config dir path

This commit is contained in:
Jacky 2021-03-09 19:24:28 +08:00
parent cd6047ed50
commit 0ad1b3af4b
12 changed files with 219 additions and 59 deletions

20
server/test/nginx_test.go Normal file
View file

@ -0,0 +1,20 @@
package test
import (
"fmt"
"log"
"os/exec"
"regexp"
"testing"
)
func TestGetNginx(t *testing.T) {
out, err := exec.Command("nginx", "-V").CombinedOutput()
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", out)
r, _ := regexp.Compile("--conf-path=(.*)/(.*.conf)")
fmt.Println(r.FindStringSubmatch(string(out))[1])
}