Add version and fix port search.
This commit is contained in:
parent
63cd51f891
commit
e276649fc5
@ -20,8 +20,9 @@ func main() {
|
|||||||
conf.LoadConfig(".hoster.yml")
|
conf.LoadConfig(".hoster.yml")
|
||||||
|
|
||||||
app := &cli.App{
|
app := &cli.App{
|
||||||
Name: "hoster",
|
Name: "hoster",
|
||||||
Usage: "Hoster",
|
Usage: "Hoster",
|
||||||
|
Version: "1.0.0",
|
||||||
Commands: []*cli.Command{
|
Commands: []*cli.Command{
|
||||||
{
|
{
|
||||||
Name: "new",
|
Name: "new",
|
||||||
@ -50,7 +51,7 @@ func main() {
|
|||||||
|
|
||||||
projectFolder := filepath.Join(projectRoot, name)
|
projectFolder := filepath.Join(projectRoot, name)
|
||||||
|
|
||||||
existingProjects, err := helpers.FindHostConfigs(sitesEnabled)
|
existingProjects, err := helpers.FindHostConfigs(sitesAvail)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ func FindHostConfigs(path string) ([]types.Project, error) {
|
|||||||
return projects, nil
|
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+(.+);`)
|
var serverNameRegex = regexp.MustCompile(`server_name\s+(.+);`)
|
||||||
|
|
||||||
func parseHostFile(filePath string, project *types.Project) error {
|
func parseHostFile(filePath string, project *types.Project) error {
|
||||||
@ -47,8 +47,13 @@ func parseHostFile(filePath string, project *types.Project) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(line, "listen ") {
|
if strings.HasPrefix(line, "proxy_pass ") {
|
||||||
port := portRegex.FindStringSubmatch(line)
|
port := portRegex.FindStringSubmatch(line)
|
||||||
|
|
||||||
|
if len(port) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
project.InternalPort, err = strconv.Atoi(port[1])
|
project.InternalPort, err = strconv.Atoi(port[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user