diff --git a/sbin/docker_mk_env b/sbin/docker_mk_env index e581d2b..d101af1 100755 --- a/sbin/docker_mk_env +++ b/sbin/docker_mk_env @@ -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