Add version and fix port search.
This commit is contained in:
@ -28,7 +28,7 @@ func FindHostConfigs(path string) ([]types.Project, error) {
|
||||
return projects, nil
|
||||
}
|
||||
|
||||
var portRegex = regexp.MustCompile(`listen\s+(\d+)`)
|
||||
var portRegex = regexp.MustCompile(`proxy_pass http://.+:(\d+)`)
|
||||
var serverNameRegex = regexp.MustCompile(`server_name\s+(.+);`)
|
||||
|
||||
func parseHostFile(filePath string, project *types.Project) error {
|
||||
@ -47,8 +47,13 @@ func parseHostFile(filePath string, project *types.Project) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.HasPrefix(line, "listen ") {
|
||||
if strings.HasPrefix(line, "proxy_pass ") {
|
||||
port := portRegex.FindStringSubmatch(line)
|
||||
|
||||
if len(port) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
project.InternalPort, err = strconv.Atoi(port[1])
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user