Skip to content

Commit 9827db0

Browse files
committed
Update Scripts
1 parent cf9ad6c commit 9827db0

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

services

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# This will force the script to use docker-compose which may be more reliable in
1515
# some cases (or if an older version of Docker is being used)
1616

17-
set -e
17+
set -eo pipefail
1818

1919
dockerCmd="docker compose"
2020
if (( $# == 2 )); then
@@ -73,7 +73,7 @@ displayServices () {
7373

7474
waitForMongo () {
7575
echo -e "\n⏳ Waiting for \033[1mMongoDB\033[0m to be available\n"
76-
while ! [ `docker inspect --format='{{.State.Health.Status}}' db-mongo` == "healthy" ]
76+
while ! [ "$(docker inspect --format='{{.State.Health.Status}}' db-mongo)" == "healthy" ]
7777
do
7878
sleep 1
7979
done
@@ -82,9 +82,9 @@ waitForMongo () {
8282
waitForOrion () {
8383
echo -e "\n⏳ Waiting for \033[1;34mOrion\033[0m to be available\n"
8484

85-
while ! [ `docker inspect --format='{{.State.Health.Status}}' fiware-orion` == "healthy" ]
85+
while ! [ "$(docker inspect --format='{{.State.Health.Status}}' fiware-orion)" == "healthy" ]
8686
do
87-
echo -e "Context Broker HTTP state: " `curl -s -o /dev/null -w %{http_code} 'http://localhost:1026/version'` " (waiting for 200)"
87+
echo -e "Context Broker HTTP state: " $(curl -s -o /dev/null -w %{http_code} 'http://localhost:1026/version') " (waiting for 200)"
8888
sleep 1
8989
done
9090
}
@@ -95,7 +95,7 @@ case "${command}" in
9595
echo "usage: services [create|start|stop]"
9696
;;
9797
"start")
98-
export $(cat .env | grep "#" -v)
98+
set -a; source .env; set +a
9999
stoppingContainers
100100
echo -e "Starting containers: \033[1;34mOrion\033[0m, \033[1mTutorial\033[0m and a \033[1mMongoDB\033[0m database."
101101
echo -e "- \033[1;34mOrion\033[0m is the context broker"
@@ -110,11 +110,11 @@ case "${command}" in
110110
echo -e "Now open \033[4mhttp://localhost:3000/app/monitor\033[0m"
111111
;;
112112
"stop")
113-
export $(cat .env | grep "#" -v)
113+
set -a; source .env; set +a
114114
stoppingContainers
115115
;;
116116
"create")
117-
export $(cat .env | grep "#" -v)
117+
set -a; source .env; set +a
118118
echo "Pulling Docker images"
119119
docker pull -q quay.io/curl/curl
120120
${dockerCmd} pull --ignore-pull-failures

0 commit comments

Comments
 (0)