mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
21 lines
499 B
Go
21 lines
499 B
Go
package nginx
|
|
|
|
import (
|
|
"github.com/tufanbarisyildirim/gonginx/dumper"
|
|
"github.com/tufanbarisyildirim/gonginx/parser"
|
|
)
|
|
|
|
func (c *NgxConfig) FmtCode() (fmtContent string) {
|
|
fmtContent = dumper.DumpConfig(c.c, dumper.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 = dumper.DumpConfig(c, dumper.IndentedStyle)
|
|
return
|
|
}
|