Skip to content

Commit 0e19131

Browse files
committed
Removed ip detection, unnedded
1 parent 344177f commit 0e19131

File tree

2 files changed

+15
-43
lines changed

2 files changed

+15
-43
lines changed

Makefile

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,23 @@
11
# Makefile to facilitate the use of Docker in the exelearning-web project
22

3-
# Get the host IP (works for Unix/macOS, adjust for Windows if needed)
4-
# HOST_IP = $(shell hostname -I | awk '{print $$1}')
5-
# Get the host IP using ifconfig (for macOS/Linux)
6-
HOST_IP = $(shell ifconfig | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $$2}'
7-
8-
# Detect the operating system
3+
# Detect the operating system and shell environment
94
ifeq ($(OS),Windows_NT)
10-
# We are on Windows
11-
ifdef MSYSTEM
12-
# MSYSTEM is defined, we are in MinGW or MSYS
13-
SYSTEM_OS := unix
14-
else ifdef CYGWIN
15-
# CYGWIN is defined, we are in Cygwin
16-
SYSTEM_OS := unix
17-
else
18-
# Not in MinGW or Cygwin
19-
SYSTEM_OS := windows
20-
endif
5+
# Initially assume Windows shell
6+
SHELLTYPE := windows
7+
# Check if we are in Cygwin or MSYS (e.g., Git Bash)
8+
ifdef MSYSTEM
9+
SHELLTYPE := unix
10+
else ifdef CYGWIN
11+
SHELLTYPE := unix
12+
endif
2113
else
22-
# Not Windows, assuming Unix
23-
SYSTEM_OS := unix
24-
endif
25-
26-
# Get the host IP based on the operating system
27-
ifeq ($(SYSTEM_OS),windows)
28-
# For Windows, use ipconfig and findstr to extract the IP
29-
HOST_IP := $(shell for /F "tokens=2 delims=[]" %i in ('ping -n 1 -4 %COMPUTERNAME%') do @echo %i)
30-
else
31-
# For Unix-like systems, use ifconfig or ip (adjust for macOS/Linux)
32-
ifeq ($(shell uname), Darwin)
33-
# For macOS, use ipconfig
34-
HOST_IP := $(shell ipconfig getifaddr en0)
35-
else
36-
# For Linux, use ifconfig or ip to get the IP address
37-
HOST_IP := $(shell hostname -I | cut -d' ' -f1)
38-
endif
14+
SHELLTYPE := unix
3915
endif
4016

4117
# Check if Docker is running
4218
# This target verifies if Docker is installed and running on the system.
4319
check-docker:
44-
ifeq ($(SYSTEM_OS),windows)
20+
ifeq ($(SHELLTYPE),windows)
4521
@echo "Detected system: Windows (cmd, powershell)"
4622
@docker version > NUL 2>&1 || (echo. & echo Error: Docker is not running. Please make sure Docker is installed and running. & echo. & exit 1)
4723
else
@@ -52,7 +28,7 @@ endif
5228
# Check if the .env file exists, if not, copy from .env.dist
5329
# This target ensures that the .env file is present by copying it from .env.dist if it doesn't exist.
5430
check-env:
55-
ifeq ($(SYSTEM_OS),windows)
31+
ifeq ($(SHELLTYPE),windows)
5632
@if not exist .env ( \
5733
echo The .env file does not exist. Copying from .env.dist... && \
5834
copy .env.dist .env \
@@ -64,19 +40,15 @@ else
6440
fi
6541
endif
6642

67-
# Show the host ip address
68-
ip:
69-
@echo "The host ip address is: ${HOST_IP}"
70-
7143
# Start Docker containers in interactive mode
7244
# This target builds and starts the Docker containers, allowing interaction with the terminal.
7345
up: check-docker
74-
HOST_IP=$(HOST_IP) docker compose up --build
46+
docker compose up --build
7547

7648
# Start Docker containers in background mode (daemon)
7749
# This target builds and starts the Docker containers in the background.
7850
upd: check-docker
79-
HOST_IP=$(HOST_IP) docker compose up -d
51+
docker compose up -d
8052

8153
# Stop and remove Docker containers
8254
# This target stops and removes all running Docker containers.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ services:
4747
echo 'This is a post-configure command'
4848
echo 'Forcing upgrade to re-install exe plugin...'
4949
php admin/cli/upgrade.php --non-interactive
50-
php admin/cli/cfg.php --component=exescorm --name=exeonlinebaseuri --set=http://${HOST_IP}:8080
50+
php admin/cli/cfg.php --component=exescorm --name=exeonlinebaseuri --set=http://localhost:8080
5151
php admin/cli/cfg.php --component=exescorm --name=hmackey1 --set=CHANGE_THIS_TO_A_SECRET
5252
ports:
5353
- 80:8080

0 commit comments

Comments
 (0)