Files
twenty_crm/packages/twenty-front/scripts/inject-runtime-env.sh
Baptiste Devessier b1c0613514 Fix execution permissions (#11604)
The PR https://github.com/twentyhq/twenty/pull/11400 introduced changes
to the execution permissions of many executable files. These changes
aren't correct and must be reverted.

cc. @charlesBochet
2025-04-16 11:46:37 +02:00

26 lines
709 B
Bash
Executable File

#!/bin/sh
echo "Injecting runtime environment variables into index.html..."
CONFIG_BLOCK=$(cat << EOF
<script id="twenty-env-config">
window._env_ = {
REACT_APP_SERVER_BASE_URL: "$REACT_APP_SERVER_BASE_URL"
};
</script>
<!-- END: Twenty Config -->
EOF
)
# Use sed to replace the config block in index.html
# Using pattern space to match across multiple lines
echo "$CONFIG_BLOCK" | sed -i.bak '
/<!-- BEGIN: Twenty Config -->/,/<!-- END: Twenty Config -->/{
/<!-- BEGIN: Twenty Config -->/!{
/<!-- END: Twenty Config -->/!d
}
/<!-- BEGIN: Twenty Config -->/r /dev/stdin
/<!-- END: Twenty Config -->/d
}
' build/index.html
rm -f build/index.html.bak