gPanel/pkg/gpserver/bundles.go
George Shaw b9f7c5d065 Fix import paths
* github.com/Ennovar/gPanel -> github.com/kentonh/gPanel
2018-09-21 20:13:49 -05:00

39 lines
831 B
Go

package gpserver
import (
"fmt"
"io/ioutil"
"github.com/kentonh/gPanel/pkg/api/bundle"
"github.com/kentonh/gPanel/pkg/gpaccount"
)
func (con *Controller) detectBundles() error {
var err error = nil
bundles := make(map[string]*gpaccount.Controller)
dirs, err := ioutil.ReadDir("bundles/")
if err != nil {
fmt.Errorf("error finding bundles:%v", err.Error())
}
for _, dir := range dirs {
if dir.IsDir() {
dirPath := "bundles/" + dir.Name() + "/"
err, accPort, pubPort := bundle.GetPorts(dirPath)
curBundle, err := gpaccount.New(dirPath, dir.Name(), accPort, pubPort)
err = curBundle.Start()
err2 := curBundle.Public.Start()
if err != nil || err2 != nil {
fmt.Println("error starting bundle:", dir.Name())
}
bundles[dir.Name()] = curBundle
}
}
con.Bundles = bundles
return err
}