This is an automated email from the ASF dual-hosted git repository.

dgriffon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/master by this push:
     new c66e8c3  [UNOMI-479] Docker: Checks if there is auth needed for ES and 
adds credentials to url in entrypoint.sh. (#304)
c66e8c3 is described below

commit c66e8c3399f2f26bcc0e147b3942e64d1389d431
Author: atompie <[email protected]>
AuthorDate: Fri Jun 11 11:43:16 2021 +0200

    [UNOMI-479] Docker: Checks if there is auth needed for ES and adds 
credentials to url in entrypoint.sh. (#304)
    
    Co-authored-by: risto <[email protected]>
---
 docker/src/main/docker/entrypoint.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/docker/src/main/docker/entrypoint.sh 
b/docker/src/main/docker/entrypoint.sh
index 80f5ee0..8ffbadd 100755
--- a/docker/src/main/docker/entrypoint.sh
+++ b/docker/src/main/docker/entrypoint.sh
@@ -18,10 +18,17 @@
 
################################################################################
 # Wait for heathy ElasticSearch
 # next wait for ES status to turn to Green
-health_check="$(curl -fsSL 
"$UNOMI_ELASTICSEARCH_ADDRESSES/_cat/health?h=status")"
+
+if [ -v UNOMI_ELASTICSEARCH_USERNAME ] && [ -v UNOMI_ELASTICSEARCH_PASSWORD ]; 
then
+  
elasticsearch_addresses="$UNOMI_ELASTICSEARCH_USERNAME:$UNOMI_ELASTICSEARCH_PASSWORD@$UNOMI_ELASTICSEARCH_ADDRESSES/_cat/health?h=status"
+else
+  elasticsearch_addresses="$UNOMI_ELASTICSEARCH_ADDRESSES/_cat/health?h=status"
+fi
+
+health_check="$(curl -fsSL "$elasticsearch_addresses")"
 
 until ([ "$health_check" = 'yellow' ] || [ "$health_check" = 'green' ]); do
-    health_check="$(curl -fsSL 
"$UNOMI_ELASTICSEARCH_ADDRESSES/_cat/health?h=status")"
+    health_check="$(curl -fsSL $elasticsearch_addresses)"
     >&2 echo "Elastic Search is not yet available - waiting (health 
check=$health_check)..."
     sleep 1
 done

Reply via email to