#!/bin/sh
# Ensure specified environment variable is lowercase
# specify the environment variable to validate as an argument (or array of arguments)
# reserve first argument for the environment variable name
ENV_VAR_NAME=$1

for var in "${@:2}"; do
    # get the value of the specified environment variable
    value=$(eval echo \$$var)
    # check if the value is not lowercase
    if [[ $value =~ [A-Z] ]]; then
        echo "❌ Invalid $ENV_VAR_NAME: $value"
        echo "â„šī¸ $ENV_VAR_NAME must be lowercase"
        exit 1
    else
        echo "✅ $ENV_VAR_NAME is lowercase: $value"
    fi
done