refactor: decrease compile time for golang plugins
This change refactors the compiled golang plugins into 3 distinct binaries: - commands: already existing - subcommands/subcommands: entrypoint into all subcommands - triggers: entrypoint into all triggers It then further symlinks triggers and subcommands to the built binaries. This results in both a much faster build process as well as smaller package size.
This commit is contained in:
48
plugins/network/subcommands.go
Normal file
48
plugins/network/subcommands.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package network
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
)
|
||||
|
||||
// rebuilds network settings for all apps
|
||||
func CommandRebuildall() {
|
||||
apps, err := common.DokkuApps()
|
||||
if err != nil {
|
||||
common.LogFail(err.Error())
|
||||
}
|
||||
for _, appName := range apps {
|
||||
BuildConfig(appName)
|
||||
}
|
||||
}
|
||||
|
||||
// displays a network report for one or more apps
|
||||
func CommandReport(appName string, infoFlag string) {
|
||||
if strings.HasPrefix(appName, "--") {
|
||||
infoFlag = appName
|
||||
appName = ""
|
||||
}
|
||||
|
||||
if len(appName) == 0 {
|
||||
apps, err := common.DokkuApps()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, appName := range apps {
|
||||
ReportSingleApp(appName, infoFlag)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
ReportSingleApp(appName, infoFlag)
|
||||
}
|
||||
|
||||
// set or clear a network property for an app
|
||||
func CommandSet(appName string, property string, value string) {
|
||||
if property == "bind-all-interfaces" && value == "" {
|
||||
value = "false"
|
||||
}
|
||||
|
||||
common.CommandPropertySet("network", appName, property, value, DefaultProperties)
|
||||
}
|
||||
Reference in New Issue
Block a user