diff --git a/.devcontainer/resources/phpbb-config.yml b/.devcontainer/resources/phpbb-config.yml index 9a9db6abff..9c781c1201 100644 --- a/.devcontainer/resources/phpbb-config.yml +++ b/.devcontainer/resources/phpbb-config.yml @@ -30,7 +30,7 @@ installer: server: cookie_secure: false server_protocol: http:// - force_server_vars: false + force_server_vars: true server_name: localhost server_port: 80 script_path: / diff --git a/.devcontainer/resources/setup.sh b/.devcontainer/resources/setup.sh index b871db11df..9d01fdf16d 100644 --- a/.devcontainer/resources/setup.sh +++ b/.devcontainer/resources/setup.sh @@ -34,6 +34,14 @@ sudo ln -s /workspaces/phpbb/phpBB /var/www/html echo "[Codespaces] Copy phpBB configuration" cp /workspaces/phpbb/.devcontainer/resources/phpbb-config.yml /workspaces/phpbb/phpBB/install/install-config.yml +# Force the server URL to reflect the Codespace +# https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace +if [ "$CODESPACES" = true ] ; then + echo "[Codespaces] Set the phpBB server name using default environment variables" + codespaces_url="${CODESPACE_NAME}-80.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" + sed -i "s/localhost/$codespaces_url/g" /workspaces/phpbb/phpBB/install/install-config.yml +fi + # Install phpBB echo "[Codespaces] Run phpBB CLI installation" cd /workspaces/phpbb/phpBB && composer install --no-interaction