Skip to content

Commit

Permalink
Merge branch 'release/1.0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Feb 15, 2023
2 parents 095cffc + 60c2d3e commit 604c894
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .docker-config/php/banner_message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Rewrite the PRIMARY_SITE_URL env var if we're running in Codespaces
if [[ ! ${CODESPACES:-"unset"} == "unset" ]]; then
export PRIMARY_SITE_URL="https://${CODESPACE_NAME}-${DEV_SERVER_PORT}.preview.app.github.dev/"
export PRIMARY_SITE_URL="https://${CODESPACE_NAME}-${DEV_SERVER_PORT}.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/"
fi
# Banner message
sleep 1
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# nystudio107/spin-up-craft Change Log

## 1.0.6 - 2023.02.15
### Changed
* Use the `GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN` env var
* Use `env_file` & `env` aliases in the docker-compose.yaml

## 1.0.5 - 2023.02.14
### Added
* Detect when we're running in Codespaces, and swap in the dynamic URL for the `PRIMARY_SITE_URL` env var automatically
Expand Down
5 changes: 3 additions & 2 deletions config/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
if (App::env('CODESPACES')) {
// putenv() only affects the OS's environment, so set it directly
$_ENV['PRIMARY_SITE_URL'] = $_SERVER['PRIMARY_SITE_URL'] = sprintf(
"https://%s-%s.preview.app.github.dev/",
"https://%s-%s.%s/",
App::env('CODESPACE_NAME'),
App::env('DEV_SERVER_PORT')
App::env('DEV_SERVER_PORT'),
App::env('GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN')
);
}

Expand Down
16 changes: 9 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ services:
dockerfile: ./Dockerfile
depends_on:
- "php"
env_file: &env
env_file: &env_file
- ./.env
environment: &env
CODESPACES: "${CODESPACES}"
CODESPACE_NAME: "${CODESPACE_NAME}"
GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN: "${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
init: true
ports:
- "${DEV_SERVER_PORT}:80"
Expand All @@ -24,10 +28,9 @@ services:
depends_on:
- "mysql"
env_file:
*env
*env_file
environment:
CODESPACES: "${CODESPACES}"
CODESPACE_NAME: "${CODESPACE_NAME}"
*env
expose:
- "9000"
init: true
Expand Down Expand Up @@ -68,10 +71,9 @@ services:
depends_on:
- "php"
env_file:
*env
*env_file
environment:
CODESPACES: "${CODESPACES}"
CODESPACE_NAME: "${CODESPACE_NAME}"
*env
init: true
tty: true
volumes:
Expand Down

0 comments on commit 604c894

Please sign in to comment.