diff --git a/plugins/caddy-vhosts/post-create b/plugins/caddy-vhosts/post-create new file mode 100755 index 000000000..ef6b515ed --- /dev/null +++ b/plugins/caddy-vhosts/post-create @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions" +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +trigger-caddy-vhosts-post-create() { + declare desc="caddy-vhosts post-create trigger" + declare trigger="post-create" + declare APP="$1" + + fn-plugin-property-setup-app "caddy" "$APP" +} + +trigger-caddy-vhosts-post-create "$@" diff --git a/plugins/common/properties.go b/plugins/common/properties.go index b472c24b9..c6c6e3b3e 100644 --- a/plugins/common/properties.go +++ b/plugins/common/properties.go @@ -540,6 +540,14 @@ func PropertySetup(pluginName string) error { }) } +func PropertySetupApp(pluginName string, appName string) error { + if err := makePluginAppPropertyPath(pluginName, appName); err != nil { + return fmt.Errorf("Unable to create %s config directory for %s: %s", pluginName, appName, err.Error()) + } + + return nil +} + func getPropertyPath(pluginName string, appName string, property string) string { pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName) return filepath.Join(pluginAppConfigRoot, property) diff --git a/plugins/common/property-functions b/plugins/common/property-functions index 2c45dcfd5..00d8a6a11 100755 --- a/plugins/common/property-functions +++ b/plugins/common/property-functions @@ -104,3 +104,9 @@ fn-plugin-property-setup() { declare PLUGIN="$1" "$PLUGIN_CORE_AVAILABLE_PATH/common/prop" "setup" "$PLUGIN" } + +fn-plugin-property-setup-app() { + declare desc="setup the properties for an app" + declare PLUGIN="$1" APP="$2" + "$PLUGIN_CORE_AVAILABLE_PATH/common/prop" "setup-app" "$PLUGIN" "$APP" +} diff --git a/plugins/common/src/prop/prop.go b/plugins/common/src/prop/prop.go index 9c06bb2bb..5c2a87c78 100644 --- a/plugins/common/src/prop/prop.go +++ b/plugins/common/src/prop/prop.go @@ -194,5 +194,12 @@ func main() { fmt.Fprintln(os.Stderr, err.Error()) os.Exit(1) } + case "setup-app": + appName := flag.Arg(2) + err := common.PropertySetupApp(pluginName, appName) + if err != nil { + fmt.Fprintln(os.Stderr, err.Error()) + os.Exit(1) + } } } diff --git a/plugins/haproxy-vhosts/post-create b/plugins/haproxy-vhosts/post-create new file mode 100755 index 000000000..e484971b8 --- /dev/null +++ b/plugins/haproxy-vhosts/post-create @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions" +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +trigger-haproxy-vhosts-post-create() { + declare desc="haproxy-vhosts post-create trigger" + declare trigger="post-create" + declare APP="$1" + + fn-plugin-property-setup-app "haproxy" "$APP" +} + +trigger-haproxy-vhosts-post-create "$@" diff --git a/plugins/openresty-vhosts/post-create b/plugins/openresty-vhosts/post-create new file mode 100755 index 000000000..0438e22fb --- /dev/null +++ b/plugins/openresty-vhosts/post-create @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions" + +trigger-openresty-vhosts-post-create() { + declare desc="openresty-vhosts post-create trigger" + declare trigger="post-create" + declare APP="$1" + + fn-plugin-property-setup-app "openresty" "$APP" +} + +trigger-openresty-vhosts-post-create "$@" diff --git a/plugins/proxy/functions b/plugins/proxy/functions index 7a83e9677..df5e04374 100755 --- a/plugins/proxy/functions +++ b/plugins/proxy/functions @@ -47,7 +47,7 @@ fn-proxy-report-label-overwrite() { fn-proxy-get-labels-file-path() { declare desc="return proxy labels config file path for specified proxy" declare PROXY="$1" APP="$2" - local PROXY_FILE="${DOKKU_ROOT}/${APP}/PROXY_LABELS_${PROXY^^}" + local PROXY_FILE="${DOKKU_LIB_ROOT}/config/${PROXY}/${APP}/labels" echo "$PROXY_FILE" } diff --git a/plugins/traefik-vhosts/post-create b/plugins/traefik-vhosts/post-create new file mode 100755 index 000000000..2e65c1f4c --- /dev/null +++ b/plugins/traefik-vhosts/post-create @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions" +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +trigger-traefik-vhosts-post-create() { + declare desc="traefik-vhosts post-create trigger" + declare trigger="post-create" + declare APP="$1" + + fn-plugin-property-setup-app "traefik" "$APP" +} + +trigger-traefik-vhosts-post-create "$@"