Skip to content

Commit 7987f4f

Browse files
committed
Amend variable loading
1 parent 224a18c commit 7987f4f

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

services

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ getHeartbeat(){
4545
waitForOrion () {
4646
echo -e "\n⏳ Waiting for \033[1;34mOrion-LD\033[0m to be available\n"
4747

48-
while ! [ `docker inspect --format='{{.State.Health.Status}}' fiware-orion` == "healthy" ]
48+
while ! [ "$(docker inspect --format='{{.State.Health.Status}}' fiware-orion)" == "healthy" ]
4949
do
5050
echo -e "\nContext Broker HTTP state: ${response} (waiting for 200)"
5151
pause 6
@@ -67,16 +67,16 @@ waitForScorpio () {
6767
waitForStellio () {
6868
echo -e "\n⏳ Waiting for \033[1;34mStellio\033[0m to respond\n"
6969
waitSeconds=30
70-
while [ `docker run --network fiware_default --rm quay.io/curl/curl:${CURL_VERSION} -s -o /dev/null -w %{http_code} 'http://stellio:8080/ngsi-ld/v1/entities/?type=X'` -eq 000 ]
70+
while [ "$(docker run --network fiware_default --rm quay.io/curl/curl:${CURL_VERSION} -s -o /dev/null -w %{http_code} 'http://stellio:8080/ngsi-ld/v1/entities/?type=X')" -eq 000 ]
7171
do
72-
echo -e "Context Broker HTTP state: " `curl -s -o /dev/null -w %{http_code} 'http://localhost:8080/ngsi-ld/v1/entities/?type=X'` " (waiting for 500)"
72+
echo -e "Context Broker HTTP state: " $(curl -s -o /dev/null -w %{http_code} 'http://localhost:8080/ngsi-ld/v1/entities/?type=X') " (waiting for 500)"
7373
echo -e "Waiting for ${waitSeconds} seconds ..."
7474
sleep ${waitSeconds}
7575
done
7676
echo -e "\n⏳ Waiting for all \033[1;34mStellio\033[0m services to be available\n"
77-
while [ `docker run --network fiware_default --rm quay.io/curl/curl:${CURL_VERSION} -s -o /dev/null -w %{http_code} 'http://stellio:8080/ngsi-ld/v1/entities/?type=X'` -eq 500 ]
77+
while [ "$(docker run --network fiware_default --rm quay.io/curl/curl:${CURL_VERSION} -s -o /dev/null -w %{http_code} 'http://stellio:8080/ngsi-ld/v1/entities/?type=X')" -eq 500 ]
7878
do
79-
echo -e "Context Broker HTTP state: " `curl -s -o /dev/null -w %{http_code} 'http://localhost:8080/ngsi-ld/v1/entities/?type=X'` " (waiting for 200)"
79+
echo -e "Context Broker HTTP state: " $(curl -s -o /dev/null -w %{http_code} 'http://localhost:8080/ngsi-ld/v1/entities/?type=X') " (waiting for 200)"
8080
echo -e "Waiting for ${waitSeconds} seconds ..."
8181
sleep ${waitSeconds}
8282
done
@@ -106,17 +106,17 @@ waitForUserContext () {
106106

107107
waitForMongo () {
108108
echo -e "\n⏳ Waiting for \033[1mMongoDB\033[0m to be available\n"
109-
while ! [ `docker inspect --format='{{.State.Health.Status}}' db-mongo` == "healthy" ]
109+
while ! [ "$(docker inspect --format='{{.State.Health.Status}}' db-mongo)" == "healthy" ]
110110
do
111111
sleep 1
112112
done
113113
}
114114

115115
waitForIoTAgent () {
116116
echo -e "\n⏳ Waiting for \033[1;36mIoT-Agent\033[0m to be available\n"
117-
while [ `docker run --network fiware_default --rm quay.io/curl/curl:${CURL_VERSION} -s -o /dev/null -w %{http_code} 'http://iot-agent:4041/version'` -eq 000 ]
117+
while [ "$(docker run --network fiware_default --rm quay.io/curl/curl:${CURL_VERSION} -s -o /dev/null -w %{http_code} 'http://iot-agent:4041/version')" -eq 000 ]
118118
do
119-
echo -e "IoT Agent HTTP state: " `curl -s -o /dev/null -w %{http_code} 'http://localhost:4041/version'` " (waiting for 200)"
119+
echo -e "IoT Agent HTTP state: " $(curl -s -o /dev/null -w %{http_code} 'http://localhost:4041/version') " (waiting for 200)"
120120
sleep 6
121121
done
122122
}
@@ -195,7 +195,7 @@ case "${command}" in
195195
echo "usage: services [create|orion|scorpio|stellio|stop]"
196196
;;
197197
"orion")
198-
export $(cat .env | grep "#" -v)
198+
set -a; source .env; set +a
199199
stoppingContainers
200200
waitForCoreContext
201201
echo -e "Starting containers: \033[1;34mOrion\033[0m, \033[1;34mQuantumLeap\033[0m, \033[1;36mIoT-Agent\033[0m, \033[1mTutorial\033[0m, a linked data \033[1mContext\033[0m, a \033[1mGrafana\033[0m metrics dashboard, \033[1mCrateDB\033[0m and \033[1mMongoDB\033[0m databases and a \033[1mRedis\033[0m cache."
@@ -216,7 +216,7 @@ case "${command}" in
216216
;;
217217

218218
"scorpio")
219-
export $(cat .env | grep "#" -v)
219+
set -a; source .env; set +a
220220
stoppingContainers
221221
waitForCoreContext
222222
echo -e "Starting containers: \033[1;34mScorpio\033[0m, and a \033[1mPostgres\033[0m database, \033[1;34mQuantumLeap\033[0m, \033[1;36mIoT-Agent\033[0m, \033[1mTutorial\033[0m, a linked data \033[1mContext\033[0m, a \033[1mGrafana\033[0m metrics dashboard, \033[1mCrateDB\033[0m and \033[1mMongoDB\033[0m databases and a \033[1mRedis\033[0m cache."
@@ -237,7 +237,7 @@ case "${command}" in
237237
echo -e "Now open \033[4mhttp://localhost:3000/device/monitor\033[0m"
238238
;;
239239
"stellio")
240-
export $(cat .env | grep "#" -v)
240+
set -a; source .env; set +a
241241
stoppingContainers
242242
waitForCoreContext
243243
echo -e "Starting containers: \033[1;34mStellio\033[0m, \033[1mKafka\033[0m, \033[1mZookeeper\033[0m and a \033[1mPostgres\033[0m database, \033[1;34mQuantumLeap\033[0m, \033[1;36mIoT-Agent\033[0m, \033[1mTutorial\033[0m, a linked data \033[1mContext\033[0m, a \033[1mGrafana\033[0m metrics dashboard, \033[1mCrateDB\033[0m and \033[1mMongoDB\033[0m databases and a \033[1mRedis\033[0m cache."
@@ -258,15 +258,15 @@ case "${command}" in
258258
echo -e "Now open \033[4mhttp://localhost:3000/device/monitor\033[0m"
259259
;;
260260
"stop")
261-
export $(cat .env | grep "#" -v)
261+
set -a; source .env; set +a
262262
stoppingContainers
263263
;;
264264
"start")
265-
export $(cat .env | grep "#" -v)
265+
set -a; source .env; set +a
266266
./services ${CONTEXT_BROKER:=orion} $2
267267
;;
268268
"create")
269-
export $(cat .env | grep "#" -v)
269+
set -a; source .env; set +a
270270
echo "Pulling Docker images"
271271
docker pull -q quay.io/curl/curl:${CURL_VERSION}
272272
${dockerCmd} -f docker-compose/common.yml -f docker-compose/common.yml -f docker-compose/scorpio.yml -f docker-compose/orion-ld.yml -f docker-compose/stellio.yml pull

0 commit comments

Comments
 (0)