[GH-ISSUE #22] DumpConfig not print lua block content #8

Closed
opened 2026-02-28 01:20:29 +03:00 by kerem · 1 comment
Owner

Originally created by @ermazi on GitHub (Jun 21, 2023).
Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/22

Originally assigned to: @tufanbarisyildirim on GitHub.

package main

import (
	"fmt"

	"github.com/tufanbarisyildirim/gonginx"
	"github.com/tufanbarisyildirim/gonginx/parser"
)

func main() {
	p := parser.NewStringParser(`
server {
location = /foo {
rewrite_by_lua_block {
res = ngx.location.capture("/memc",
{ args = { cmd = "incr", key = ngx.var.uri } } # comment contained unexpect '{'
# comment contained unexpect '}' 
)
t = { key="foo", val="bar" }
}
}
}
`)

	c := p.Parse()
	fmt.Println(gonginx.DumpConfig(c, gonginx.IndentedStyle))

}

result

server {
    location = /foo {
        rewrite_by_lua_block {

        }
    }
}

Originally created by @ermazi on GitHub (Jun 21, 2023). Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/22 Originally assigned to: @tufanbarisyildirim on GitHub. ```go package main import ( "fmt" "github.com/tufanbarisyildirim/gonginx" "github.com/tufanbarisyildirim/gonginx/parser" ) func main() { p := parser.NewStringParser(` server { location = /foo { rewrite_by_lua_block { res = ngx.location.capture("/memc", { args = { cmd = "incr", key = ngx.var.uri } } # comment contained unexpect '{' # comment contained unexpect '}' ) t = { key="foo", val="bar" } } } } `) c := p.Parse() fmt.Println(gonginx.DumpConfig(c, gonginx.IndentedStyle)) } ``` result ``` server { location = /foo { rewrite_by_lua_block { } } } ```
kerem 2026-02-28 01:20:29 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@tufanbarisyildirim commented on GitHub (Jun 26, 2023):

Thanks for reporting @ermazi

<!-- gh-comment-id:1606811833 --> @tufanbarisyildirim commented on GitHub (Jun 26, 2023): Thanks for reporting @ermazi
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gonginx#8
No description provided.