Skip to content

Commit dc218ac

Browse files
committed
Add APP_PORT to .env
1 parent 330c632 commit dc218ac

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
PROJECT_VERSION="1.0.0-alpha"
1313

14+
# App-related settings
15+
APP_PORT=8123 # must match port setting in `main.go` and EXPOSE in `Dockerfile`
16+
1417
# Docker-related settings
1518
DOCKER_IMAGE_NAME="miguno/golang-docker-build-tutorial"
1619
DOCKER_IMAGE_TAG="latest"

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ run:
9898

9999
# send request to the app's HTTP endpoint (requires running container)
100100
send-request-to-app:
101-
curl http://localhost:8123/status
101+
@curl http://localhost:${APP_PORT}/status
102102

103103
# run tests with colorized output (requires https://github.com/kyoh86/richgo)
104104
test *FLAGS:

start_container.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
# `-o pipefail`: Prevent errors in a pipeline (`|`) from being masked
66
set -uo pipefail
77

8-
declare -r APP_PORT=8123
9-
108
# Import environment variables from .env
119
set -o allexport && source .env && set +o allexport
1210
echo "Starting container for image '$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG', exposing port ${APP_PORT}/tcp"

0 commit comments

Comments
 (0)