You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
496 B
Go
22 lines
496 B
Go
package nginx
|
|
|
|
import (
|
|
"github.com/tufanbarisyildirim/gonginx"
|
|
"github.com/tufanbarisyildirim/gonginx/parser"
|
|
)
|
|
|
|
func (c *NgxConfig) FmtCode() (fmtContent string) {
|
|
fmtContent = gonginx.DumpConfig(c.c, gonginx.IndentedStyle)
|
|
return
|
|
}
|
|
|
|
func FmtCode(content string) (fmtContent string, err error) {
|
|
p := parser.NewStringParser(content, parser.WithSkipValidDirectivesErr())
|
|
c, err := p.Parse()
|
|
if err != nil {
|
|
return
|
|
}
|
|
fmtContent = gonginx.DumpConfig(c, gonginx.IndentedStyle)
|
|
return
|
|
}
|