feat: implement proxy container :label functionality

This commit is contained in:
dragonhunt02
2025-03-22 22:01:00 +00:00
committed by Jose Diaz-Gonzalez
parent e93175b37e
commit 4eafd3b5b7
18 changed files with 273 additions and 0 deletions

View File

@@ -1,9 +1,20 @@
#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/command-functions"
source "$PLUGIN_AVAILABLE_PATH/caddy-vhosts/internal-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-caddy-label() {
declare desc="set/unset/show container proxy labels"
declare cmd="caddy:label"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
set -- caddy "$@"
cmd-proxy-label "$@"
}
cmd-caddy-report() {
declare desc="displays a caddy report for one or more apps"
declare cmd="caddy:report"

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
source "$PLUGIN_AVAILABLE_PATH/caddy-vhosts/internal-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
@@ -129,6 +130,15 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
fi
fi
local proxy_labels_file_path=$(fn-proxy-get-labels-file-path "$APP" caddy)
fn-proxy-report-label-overwrite "$output" "$proxy_labels_file_path"
if [[ -f "$proxy_labels_file_path" ]]; then
local user_proxy_labels="$(<"$proxy_labels_file_path")"
user_proxy_labels="$(echo "$user_proxy_labels" | tr '\r\n' ' ')"
output="$output $user_proxy_labels"
fi
echo -n "$STDIN$output"
}

View File

@@ -30,6 +30,7 @@ fn-help-content() {
caddy:report [<app>] [<flag>], Displays an caddy report for one or more apps
caddy:set <app> <property> (<value>), Set or clear an caddy property for an app
caddy:show-config <app>, Display caddy compose config
caddy:label <app> <show | set | unset> <property> (<value>), Show, set or clear a caddy label for an app
caddy:start, Starts the caddy server
caddy:stop, Stops the caddy server
help_content

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
source "$PLUGIN_AVAILABLE_PATH/caddy-vhosts/command-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-caddy-label "$@"