mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
bug fix and auto detect nginx config dir path
This commit is contained in:
parent
cd6047ed50
commit
0ad1b3af4b
12 changed files with 219 additions and 59 deletions
20
server/test/nginx_test.go
Normal file
20
server/test/nginx_test.go
Normal 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])
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue