Skip to content

Commit

Permalink
fix env declaration (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
NyakudyaA committed Mar 26, 2023
1 parent ce3ed58 commit b8d4388
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/functions.sh
Expand Up @@ -340,12 +340,12 @@ function geoserver_logging() {
}

# Function to read env variables from secrets
function file_env {
function file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${1:-}"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
printf >&2 'error: both %s and %s are set (but are exclusive)\n' "$var" "$fileVar"
exit 1
fi
local val="$def"
Expand All @@ -357,7 +357,6 @@ function file_env {
export "$var"="$val"
unset "$fileVar"
}

# Credits to https://github.com/korkin25 from https://github.com/kartoza/docker-geoserver/pull/371
function set_vars() {
if [ -z "${INSTANCE_STRING}" ];then
Expand Down
1 change: 1 addition & 0 deletions scripts/update_passwords.sh
Expand Up @@ -36,6 +36,7 @@ if [[ "${USE_DEFAULT_CREDENTIALS}" =~ [Ff][Aa][Ll][Ss][Ee] ]]; then
fi

# Set random password if none provided
file_env 'GEOSERVER_ADMIN_PASSWORD'
if [[ -z ${GEOSERVER_ADMIN_PASSWORD} ]]; then
generate_random_string 15
GEOSERVER_ADMIN_PASSWORD=${RAND}
Expand Down

0 comments on commit b8d4388

Please sign in to comment.