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/openresty-vhosts/internal-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-openresty-label() {
declare desc="set/unset/show container proxy labels"
declare cmd="openresty:label"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
set -- openresty "$@"
cmd-proxy-label "$@"
}
cmd-openresty-report() {
declare desc="displays a openresty report for one or more apps"
declare cmd="openresty:report"

View File

@@ -2,6 +2,7 @@
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
source "$PLUGIN_AVAILABLE_PATH/openresty-vhosts/internal-functions"
trigger-openresty-vhosts-docker-args-process-deploy() {
@@ -181,6 +182,15 @@ trigger-openresty-vhosts-docker-args-process-deploy() {
value="$(fn-openresty-x-forwarded-ssl "$APP")"
[[ -n "$value" ]] && output="$output '--label=openresty.x-forwarded-ssl=$value'"
local proxy_labels_file_path=$(fn-proxy-get-labels-file-path "$APP" openresty)
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() {
openresty:report [<app>] [<flag>], Displays an openresty report for one or more apps
openresty:set <app> <property> (<value>), Set or clear an openresty property for an app
openresty:show-config <app>, Display openresty compose config
openresty:label <app> <show | set | unset> <property> (<value>), Show, set or clear an openresty label for an app
openresty:start, Starts the openresty server
openresty:stop, Stops the openresty server
help_content

View File

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