-
Notifications
You must be signed in to change notification settings - Fork 32
/
beak
executable file
·54 lines (43 loc) · 1.2 KB
/
beak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
# If the environment file for the Panel exists we want to source it so
# that any environment variables defined within that are passed along to
# additional commands we may call here.
if [ -f ./code/panel/.env ]; then
source ./code/panel/.env
fi
export WWWUSER=${WWWUSER:-$UID}
export WWWGROUP=${WWWGROUP:-$(id -g)}
if ! docker compose &>/dev/null; then
DOCKER_COMPOSE=(docker-compose)
else
DOCKER_COMPOSE=(docker compose)
fi
ARGS=()
PEXEC=(exec -u pterodactyl app)
# Handle SSH into the container for the Panel.
if [ "$1" == "app" ]; then
shift 1
CONTAINER_USER=pterodactyl
if [ "$1" == "root" ]; then
CONTAINER_USER=root
fi
ARGS+=(exec -u "$CONTAINER_USER" app bash)
# Boot into the wings instance.
elif [ "$1" == "wings" ]; then
shift 1
"${DOCKER_COMPOSE[@]}" exec -u root wings bash
# Start an artisan instance within the container.
elif [ "$1" == "artisan" ]; then
shift 1
ARGS+=("${PEXEC[@]}" php artisan "$@")
# Handle tinker commands.
elif [ "$1" == "tinker" ]; then
shift 1
ARGS+=("${PEXEC[@]}" php artisan tinker)
elif [ "$1" == "serve" ]; then
shift 1
ARGS+=("${PEXEC[@]}" yarn run serve "$@")
else
ARGS+=("$@")
fi
"${DOCKER_COMPOSE[@]}" "${ARGS[@]}"