-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcommands
executable file
·74 lines (51 loc) · 1.82 KB
/
commands
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# Check if name is specified
if [[ $1 == nvcc ]] || [[ $1 == nvcc:* ]]; then
if [[ -z $2 ]]; then
echo "You must specify an app name"
exit 1
else
APP="$2"
# Check if app exists with the same name
if [ ! -d "$DOKKU_ROOT/$APP" ]; then
echo "App $APP does not exist"
exit 1
fi
fi
case "$1" in
nvcc:nginx.conf)
cat "$DOKKU_ROOT/$APP/nginx.conf"
;;
nvcc:nginx.conf.d)
if [ -d "$DOKKU_ROOT/$APP/nginx.conf.d/" ] && [ "$(ls -A $DOKKU_ROOT/$APP/nginx.conf.d/)" ]; then
ls -l "$DOKKU_ROOT/$APP/nginx.conf.d/"
else
echo "$DOKKU_ROOT/$APP/nginx.conf.d/ does not exist or is empty"
exit 1
fi
;;
nvcc:nginx-vhosts-custom-configuration.conf)
if [ -f "$DOKKU_ROOT/$APP/nginx.conf.d/nginx-vhosts-custom-configuration.conf" ]; then
cat "$DOKKU_ROOT/$APP/nginx.conf.d/nginx-vhosts-custom-configuration.conf"
else
echo "$DOKKU_ROOT/$APP/nginx.conf.d/nginx-vhosts-custom-configuration.conf does not exist"
exit 1
fi
;;
nvcc:port)
cat "$DOKKU_ROOT/$APP/PORT"
;;
help)
cat && cat<<EOF
nvcc:nginx.conf <app> display the current nginx.conf
nvcc:nginx.conf.d <app> display the current nginx.conf.d/ directory contents
nvcc:nginx-vhosts-custom-configuration.conf <app> will display the current nginx.conf.d/nginx-vhosts-custom-configuration.conf contents
nvcc:port <app> will display the current container port
EOF
;;
*)
echo "Command $1 does not exist"
;;
esac
fi