mirror of https://github.com/1Panel-dev/1Panel
ssongliu
9 months ago
committed by
GitHub
20 changed files with 23 additions and 480 deletions
@ -1,14 +0,0 @@
|
||||
package nginx |
||||
|
||||
import ( |
||||
"github.com/1Panel-dev/1Panel/backend/utils/nginx/components" |
||||
"github.com/1Panel-dev/1Panel/backend/utils/nginx/parser" |
||||
) |
||||
|
||||
func GetConfig(path string) (*components.Config, error) { |
||||
p, err := parser.NewParser(path) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
return p.Parse() |
||||
} |
@ -1,21 +0,0 @@
|
||||
package nginx |
||||
|
||||
import ( |
||||
"fmt" |
||||
"testing" |
||||
) |
||||
|
||||
func TestNginx(t *testing.T) { |
||||
//config, err := GetConfig("/opt/1Panel/data/apps/nginx/nginx-1/conf/conf.d/word-1.conf")
|
||||
config, err := GetConfig("/opt/1Panel/data/apps/nginx/nginx-new/conf/conf.d/1panel.cloud.conf") |
||||
if err != nil { |
||||
panic(err) |
||||
} |
||||
|
||||
//server := config.FindServers()[0]
|
||||
//fmt.Println(server)
|
||||
//serverD := config.FindServers()[0]
|
||||
//serverD.AddListen("8989", false)
|
||||
|
||||
fmt.Println(DumpConfig(config, IndentedStyle)) |
||||
} |
Loading…
Reference in new issue