@@ -3,8 +3,6 @@ package self_check
33import (
44 "fmt"
55 "os"
6- "path/filepath"
7- "runtime"
86 "strings"
97 "time"
108
@@ -14,15 +12,6 @@ import (
1412 "github.com/tufanbarisyildirim/gonginx/parser"
1513)
1614
17- func resolvePath (path ... string ) string {
18- // fix #1046
19- if runtime .GOOS == "windows" {
20- return strings .TrimLeft (filepath .ToSlash (strings .ReplaceAll (nginx .GetConfPath (path ... ), nginx .GetNginxExeDir (), "" )), "/" )
21- }
22-
23- return nginx .GetConfPath (path ... )
24- }
25-
2615// CheckNginxConfIncludeSites checks if nginx.conf include sites-enabled
2716func CheckNginxConfIncludeSites () error {
2817 path := nginx .GetConfEntryPath ()
@@ -240,7 +229,7 @@ func FixNginxConfIncludeConfD() error {
240229 // add include conf.d/*.conf to http block
241230 includeDirective := & config.Directive {
242231 Name : "include" ,
243- Parameters : []config.Parameter {{Value : resolvePath ("conf.d/*.conf " )}},
232+ Parameters : []config.Parameter {{Value : resolvePath ("conf.d/*" )}},
244233 }
245234
246235 realBlock := v .GetBlock ().(* config.HTTP )
@@ -252,6 +241,6 @@ func FixNginxConfIncludeConfD() error {
252241 }
253242
254243 // if no http block, append http block with include conf.d/*.conf
255- content = append (content , fmt .Appendf (nil , "\n http {\n \t include %s;\n }\n " , resolvePath ("conf.d/*.conf " ))... )
244+ content = append (content , fmt .Appendf (nil , "\n http {\n \t include %s;\n }\n " , resolvePath ("conf.d/*" ))... )
256245 return os .WriteFile (path , content , 0644 )
257246}
0 commit comments