@@ -3,8 +3,6 @@ package self_check
3
3
import (
4
4
"fmt"
5
5
"os"
6
- "path/filepath"
7
- "runtime"
8
6
"strings"
9
7
"time"
10
8
@@ -14,15 +12,6 @@ import (
14
12
"github.com/tufanbarisyildirim/gonginx/parser"
15
13
)
16
14
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
-
26
15
// CheckNginxConfIncludeSites checks if nginx.conf include sites-enabled
27
16
func CheckNginxConfIncludeSites () error {
28
17
path := nginx .GetConfEntryPath ()
@@ -240,7 +229,7 @@ func FixNginxConfIncludeConfD() error {
240
229
// add include conf.d/*.conf to http block
241
230
includeDirective := & config.Directive {
242
231
Name : "include" ,
243
- Parameters : []config.Parameter {{Value : resolvePath ("conf.d/*.conf " )}},
232
+ Parameters : []config.Parameter {{Value : resolvePath ("conf.d/*" )}},
244
233
}
245
234
246
235
realBlock := v .GetBlock ().(* config.HTTP )
@@ -252,6 +241,6 @@ func FixNginxConfIncludeConfD() error {
252
241
}
253
242
254
243
// 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/*" ))... )
256
245
return os .WriteFile (path , content , 0644 )
257
246
}
0 commit comments