feat: add network:report command
This commit is contained in:
@@ -4,10 +4,9 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
"github.com/dokku/dokku/plugins/network"
|
||||
)
|
||||
|
||||
// returns the listeners (host:port combinations) for a given app container
|
||||
@@ -15,18 +14,6 @@ func main() {
|
||||
flag.Parse()
|
||||
appName := flag.Arg(0)
|
||||
|
||||
dokkuRoot := common.MustGetEnv("DOKKU_ROOT")
|
||||
appRoot := strings.Join([]string{dokkuRoot, appName}, "/")
|
||||
|
||||
files, _ := filepath.Glob(appRoot + "/IP.web.*")
|
||||
|
||||
var listeners []string
|
||||
for _, ipfile := range files {
|
||||
portfile := strings.Replace(ipfile, "/IP.web.", "/PORT.web.", 1)
|
||||
ipAddress := common.ReadFirstLine(ipfile)
|
||||
port := common.ReadFirstLine(portfile)
|
||||
listeners = append(listeners, fmt.Sprintf("%s:%s", ipAddress, port))
|
||||
}
|
||||
|
||||
listeners := network.GetListeners(appName)
|
||||
fmt.Fprint(os.Stdout, strings.Join(listeners, " "))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user