-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfo
More file actions
executable file
·50 lines (43 loc) · 1.07 KB
/
info
File metadata and controls
executable file
·50 lines (43 loc) · 1.07 KB
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
#!/bin/bash
if [ -f .env ];then
source .env
source .functions.sh
fi
if [[ "$1" = "help" ]];then
echo "Usage: $0 [all|ports|help|list|<project>]"
echo " all: show all projects running status"
echo " list: show all projects"
echo " ports: show all ports"
echo " help: show this help"
exit
fi
if [[ "$1" = 'list' ]];then
echo "List of projects:"
cd envs&&ls *
exit 0
fi
if [[ "$1" = 'all' ]];then
./all
exit
fi
if [[ "$1" = 'ports' ]];then
./ports
exit
fi
if [[ "$1" != "" ]];then
ENVFILE="envs/$1"
else
ENVFILE=".env"
fi
if [ $DEFAULT ] && [ $DEFAULT = "random" ];then
TERM_STDOUT=$(docker-compose -p ${PROJECT} ps)
PORT=$(echo -e "$TERM_STDOUT"|grep "${PROJECT}-web-1"|sed -r 's/.+0.0.0.0:([[:digit:]]+)->80.+/\1/g')
#cat .env|sed -r '/^#/d'|sed -r "s/^(APP_URL=.+):random/\1:${PORT}/g"
if [ $PORT ];then
cat ${ENVFILE}|sed -r '/^#/d'|sed -r "s/^APP_URL=(.+):random/APP_URL=\1:${PORT}/g"
else
cat ${ENVFILE}|sed -r '/^#/d'
fi
else
cat ${ENVFILE}|sed -r '/^#/d'
fi