Merge pull request #867 from adyanth/dev

Adding CORS_HOSTS to PHP environment
This commit is contained in:
Adam Warner 2021-07-04 11:49:42 +01:00 committed by GitHub
commit 2bc1e9c5cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -199,19 +199,22 @@ setup_php_env() {
VIRTUAL_HOST="$ServerIP"
fi;
local vhost_line="\t\t\t\"VIRTUAL_HOST\" => \"${VIRTUAL_HOST}\","
local corshosts_line="\t\t\t\"CORS_HOSTS\" => \"${CORS_HOSTS}\","
local serverip_line="\t\t\t\"ServerIP\" => \"${ServerIP}\","
local php_error_line="\t\t\t\"PHP_ERROR_LOG\" => \"${PHP_ERROR_LOG}\","
# idempotent line additions
grep -qP "$vhost_line" "$PHP_ENV_CONFIG" || \
sed -i "/bin-environment/ a\\${vhost_line}" "$PHP_ENV_CONFIG"
grep -qP "$corshosts_line" "$PHP_ENV_CONFIG" || \
sed -i "/bin-environment/ a\\${corshosts_line}" "$PHP_ENV_CONFIG"
grep -qP "$serverip_line" "$PHP_ENV_CONFIG" || \
sed -i "/bin-environment/ a\\${serverip_line}" "$PHP_ENV_CONFIG"
grep -qP "$php_error_line" "$PHP_ENV_CONFIG" || \
sed -i "/bin-environment/ a\\${php_error_line}" "$PHP_ENV_CONFIG"
echo "Added ENV to php:"
grep -E '(VIRTUAL_HOST|ServerIP|PHP_ERROR_LOG)' "$PHP_ENV_CONFIG"
grep -E '(VIRTUAL_HOST|CORS_HOSTS|ServerIP|PHP_ERROR_LOG)' "$PHP_ENV_CONFIG"
}
setup_web_port() {