Skip to content

Commit

Permalink
Added the posibility to use patterns for the enviroment variable ZITI…
Browse files Browse the repository at this point in the history
…_IDENTITIES
  • Loading branch information
erikmagkekse committed Dec 1, 2024
1 parent 5924c97 commit f8722c3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,33 @@ if [[ -n "$ZITI_IDENTITY" ]]; then
echo "Error: Failed to decode and create identity file."
exit 1
fi
else
echo "ZITI_IDENTITY not detected. Checking ZITI_IDENTITIES for configuration..."

if [[ -z "$ZITI_IDENTITIES" ]]; then
echo "Error: ZITI_IDENTITIES is not set. Please configure it as a file pattern."
exit 1
fi

dir=$(dirname "$ZITI_IDENTITIES")
pattern=$(basename "$ZITI_IDENTITIES")

if [[ ! -d "$dir" ]]; then
echo "Error: Directory $dir does not exist."
exit 1
fi

echo "Scanning for files matching: $ZITI_IDENTITIES"

files=$(find "$dir" -maxdepth 1 -name "$pattern" -type f 2>/dev/null | tr '\n' ',' | sed 's/,$//')

if [[ -n "$files" ]]; then
export ZITI_IDENTITIES="$files"
echo "ZITI_IDENTITIES updated to: $ZITI_IDENTITIES"
else
echo "Error: No files found matching the pattern: $ZITI_IDENTITIES"
exit 1
fi
fi

exec "$@"

0 comments on commit f8722c3

Please sign in to comment.