mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-21 02:41:33 +03:00
b028d9fd2a
* add render.yaml * Clean environment variables --------- Co-authored-by: Charles Bochet <charles@twenty.com>
26 lines
743 B
Bash
Executable File
26 lines
743 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# scripts/setenv.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
|