diff --git a/go.mod b/go.mod index 06ab5e20..07d0c616 100644 --- a/go.mod +++ b/go.mod @@ -275,6 +275,6 @@ require ( ) replace ( - github.com/tufanbarisyildirim/gonginx v0.0.0-20240109151651-bb3e845a7a2a => github.com/0xJacky/gonginx v0.0.0-20240114153809-6a105e85b7c3 + github.com/tufanbarisyildirim/gonginx v0.0.0-20240109151651-bb3e845a7a2a => github.com/0xJacky/gonginx v0.0.0-20240116144320-46847e98c3f8 gopkg.in/ns1/ns1-go.v2 v2.7.8 => gopkg.in/ns1/ns1-go.v2 v2.7.6 ) diff --git a/go.sum b/go.sum index 0303223a..50c24e69 100644 --- a/go.sum +++ b/go.sum @@ -598,8 +598,8 @@ cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcP dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= -github.com/0xJacky/gonginx v0.0.0-20240114153809-6a105e85b7c3 h1:zf2Ynrcf96871zUDsC/ZcYHiCyb8J2lNhfysNWG7I6g= -github.com/0xJacky/gonginx v0.0.0-20240114153809-6a105e85b7c3/go.mod h1:4fTjBxMoWGOIVnGFSTS9GAZ0yMyiGzTdATQS0krQv18= +github.com/0xJacky/gonginx v0.0.0-20240116144320-46847e98c3f8 h1:WsRlIe5lYWbgVwXsNroC9sSw/q7Dz/XeCCiyFyzm1oQ= +github.com/0xJacky/gonginx v0.0.0-20240116144320-46847e98c3f8/go.mod h1:4fTjBxMoWGOIVnGFSTS9GAZ0yMyiGzTdATQS0krQv18= github.com/0xJacky/pofile v0.2.1 h1:ceNyprJOpo7wPPR0rCOuR1gfjYiS8t9YBc73tSLnlDc= github.com/0xJacky/pofile v0.2.1/go.mod h1:hOZmte1hWostNs9KCwFRhKM7hf0d19zfWosopngij74= github.com/AdamSLevy/jsonrpc2/v14 v14.1.0 h1:Dy3M9aegiI7d7PF1LUdjbVigJReo+QOceYsMyFh9qoE= diff --git a/internal/nginx/build_config.go b/internal/nginx/build_config.go index 0667735d..a4343b81 100644 --- a/internal/nginx/build_config.go +++ b/internal/nginx/build_config.go @@ -82,7 +82,7 @@ func (c *NgxConfig) BuildConfig() (content string, err error) { content += fmt.Sprintf("%sserver {\n%s}\n\n", comments, server) } - p := parser.NewStringParser(content) + p := parser.NewStringParser(content, parser.WithSkipValidDirectivesErr()) config, err := p.Parse() if err != nil { return diff --git a/internal/nginx/format_code.go b/internal/nginx/format_code.go index f1a8f2ac..84a98042 100644 --- a/internal/nginx/format_code.go +++ b/internal/nginx/format_code.go @@ -11,7 +11,7 @@ func (c *NgxConfig) FmtCode() (fmtContent string) { } func FmtCode(content string) (fmtContent string, err error) { - p := parser.NewStringParser(content) + p := parser.NewStringParser(content, parser.WithSkipValidDirectivesErr()) c, err := p.Parse() if err != nil { return diff --git a/internal/nginx/parse.go b/internal/nginx/parse.go index 9105f05d..148763ac 100644 --- a/internal/nginx/parse.go +++ b/internal/nginx/parse.go @@ -162,7 +162,7 @@ func parse(block gonginx.IBlock, ngxConfig *NgxConfig) (err error) { } func ParseNgxConfigByContent(content string) (ngxConfig *NgxConfig, err error) { - p := parser.NewStringParser(content) + p := parser.NewStringParser(content, parser.WithSkipValidDirectivesErr()) c, err := p.Parse() if err != nil { return @@ -174,7 +174,7 @@ func ParseNgxConfigByContent(content string) (ngxConfig *NgxConfig, err error) { } func ParseNgxConfig(filename string) (ngxConfig *NgxConfig, err error) { - p, err := parser.NewParser(filename) + p, err := parser.NewParser(filename, parser.WithSkipValidDirectivesErr()) if err != nil { return nil, errors.Wrap(err, "error ParseNgxConfig") } diff --git a/internal/template/template.go b/internal/template/template.go index a293170f..cb7f9856 100644 --- a/internal/template/template.go +++ b/internal/template/template.go @@ -163,7 +163,7 @@ func ParseTemplate(path, name string, bindData map[string]Variable) (c ConfigDet content = buf.String() - p := parser.NewStringParser(content) + p := parser.NewStringParser(content, parser.WithSkipValidDirectivesErr()) config, err := p.Parse() if err != nil { return