Skip to content

Commit

Permalink
fix: fixed issue with utils script (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
piximos authored Mar 22, 2024
1 parent 7610523 commit 2552514
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ function log_out() {
_exitCode="${3}"

for _lvl in "${availableLogLevels[@]}"; do
[[ "${_lvl,,}" == "${_level,,}" && "$(check_bool "${LOG_TIMESTAMPED}")" ]] && echo -e "[$(date +"%FT%T%Z") | ${_level^^}] ${_message}"
[[ "${_lvl,,}" == "${_level,,}" && -z "$(check_bool "${LOG_TIMESTAMPED}")" ]] && echo -e "[${_level^^}] ${_message}"
[[ "${_lvl}" == "${_level}" && "$(check_bool "${LOG_TIMESTAMPED}")" ]] && echo -e "[$(date +"%FT%T%Z") | ${_level^^}] ${_message}"
[[ "${_lvl}" == "${_level}" && -z "$(check_bool "${LOG_TIMESTAMPED}")" ]] && echo -e "[${_level^^}] ${_message}"
done

[[ -z "${_exitCode}" ]] || exit "${_exitCode}"
Expand Down Expand Up @@ -104,8 +104,13 @@ function check_env_var() {
_envVar="${1}"
_required="${2:-true}"

[[ (-z "${!_envVar}" || "${!_envVar,,}" == "null") && "$(check_bool "${_required}")" ]] && log_out "The required environment variable '${_envVar}' is missing. Aborting." "FATAL" 1
[[ (-z "${!_envVar}" || "${!_envVar,,}" == "null") && -z "$(check_bool "${_required}")" ]] && log_out "The environment variable '${_envVar}' is missing." "WARNING"
if [[ -z "${!_envVar}" || "${!_envVar,,}" == "null" ]]; then
if [[ "$(check_bool "${_required}")" ]]; then
log_out "The required environment variable '${_envVar}' is missing. Aborting." "FATAL" 1
else
log_out "The environment variable '${_envVar}' is missing." "WARNING"
fi
fi
}

if [[ "$(check_bool "${DEBUG_MODE}")" ]]; then
Expand Down

0 comments on commit 2552514

Please sign in to comment.