mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-24 04:23:57 +03:00
a5fe256d7e
* chore: inject enviroment at the deployment phase (#2174) * Dockerfile CMD env.sh * env.sh generates env-config.js file * index.html imports env-config.js * front/src/config/index.ts imports REACT_APP_SERVER_BASE_URL * Upgrade Dockerfiles * Add compute pg_database_url for render * fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
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
|