File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,17 @@ type options struct {
2424 skipValidDirectivesErr bool
2525}
2626
27+ func defaultOptions () options {
28+ return options {
29+ parseInclude : false ,
30+ skipIncludeParsingErr : false ,
31+ skipComments : false ,
32+ customDirectives : map [string ]string {},
33+ skipValidSubDirectiveBlock : map [string ]struct {}{},
34+ skipValidDirectivesErr : false ,
35+ }
36+ }
37+
2738// Parser is an nginx config parser
2839type Parser struct {
2940 opts options
@@ -70,7 +81,7 @@ func WithSkipIncludeParsingErr() Option {
7081// WithDefaultOptions default options
7182func WithDefaultOptions () Option {
7283 return func (p * Parser ) {
73- p .opts = options {}
84+ p .opts = defaultOptions ()
7485 }
7586}
7687
@@ -136,7 +147,7 @@ func NewParserFromLexer(lexer *lexer, opts ...Option) *Parser {
136147 configRoot , _ := filepath .Split (lexer .file )
137148 parser := & Parser {
138149 lexer : lexer ,
139- opts : options { customDirectives : make ( map [ string ] string ), skipValidSubDirectiveBlock : map [ string ] struct {}{}} ,
150+ opts : defaultOptions () ,
140151 parsedIncludes : make (map [* config.Include ]* config.Config ),
141152 configRoot : configRoot ,
142153 }
You can’t perform that action at this time.
0 commit comments