- Add prefix_add function.

This commit is contained in:
Arnaud G. GIBERT 2024-11-25 01:08:25 +01:00
parent ce4241ff9e
commit 7bf4bc661a

View File

@ -15,6 +15,24 @@ version="$1"
#-------------------------------------------------------------------------------
function prefix_add
{
prefix=$1
separator=$2
var=$3
if [[ "${prefix}" != "" ]]
then
echo -n "${prefix}${separator}"
fi
echo "${var}"
}
#-------------------------------------------------------------------------------
function dynvar_export
{
@ -64,10 +82,10 @@ function docker_service_add
if [[ "${service_name}" == "${APPL_NAME}" ]]
then
dynvar_export "${varible_prefix}_IMG_URL" "${target_url_prefix}:${target_version}"
dynvar_export "${varible_prefix}_HOST_NAME" "${HOST_NAME_PREFIX}-webapp"
dynvar_export "${varible_prefix}_HOST_NAME" "$( prefix_add "${HOST_NAME_PREFIX}" "-" "webapp")"
else
dynvar_export "${varible_prefix}_IMG_URL" "${target_url_prefix}/${target_name}:${target_version}"
dynvar_export "${varible_prefix}_HOST_NAME" "${HOST_NAME_PREFIX}-${service_name}"
dynvar_export "${varible_prefix}_HOST_NAME" "$( prefix_add "${HOST_NAME_PREFIX}" "-" "${service_name}")"
fi