mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-12 11:20:40 +03:00
26 lines
749 B
Bash
Executable File
26 lines
749 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# scripts/set-env-test.sh
|
|
|
|
# Get script's directory
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# Construct the absolute path of .env file in the project root directory
|
|
ENV_PATH="${SCRIPT_DIR}/../.env.test"
|
|
|
|
# Check if the file exists
|
|
if [ -f "${ENV_PATH}" ]; then
|
|
echo "🔵 - Loading environment variables from "${ENV_PATH}"..."
|
|
# Export env vars
|
|
while IFS= read -r line || [ -n "$line" ]; do
|
|
if echo "$line" | grep -F = &>/dev/null
|
|
then
|
|
varname=$(echo "$line" | cut -d '=' -f 1)
|
|
varvalue=$(echo "$line" | cut -d '=' -f 2- | cut -d '#' -f 1)
|
|
export "$varname"="$varvalue"
|
|
fi
|
|
done < <(grep -v '^#' "${ENV_PATH}")
|
|
else
|
|
echo "Error: ${ENV_PATH} does not exist."
|
|
exit 1
|
|
fi
|