Skip to content

Commit

Permalink
fix: fix bug in elasticvue entrypoint
Browse files Browse the repository at this point in the history
The custom configuration was added at every reload, which broke the
config
  • Loading branch information
raphael0202 committed Sep 22, 2023
1 parent cf41312 commit bff5a84
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docker/elasticvue-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# we would have done that with template mechanism,
# but elasticvue use an lod nginx
NGINX_CONF=/etc/nginx/conf.d/elasticvue.conf
# prepare snipet to eventually add to conf
>/tmp/nginx_snipet
# prepare snippet to eventually add to conf
>/tmp/nginx_snippet
CONF_MODIFIED=false
if [ -n "$NGINX_BASIC_AUTH_USER_PASSWD" ] && ! ( grep auth_basic $NGINX_CONF )
then
Expand All @@ -14,17 +14,17 @@ then
# create htpasswd file
echo "$NGINX_BASIC_AUTH_USER_PASSWD" > /etc/nginx/elasticvue_htpasswd
# change nginx config
cat >>/tmp/nginx_snipet <<END
cat >>/tmp/nginx_snippet <<END
# add auth basic globally
auth_basic "Off Search Elasticvue";
auth_basic_user_file /etc/nginx/elasticvue_htpasswd;
END
fi
if ! (grep "upstream elasticsearch" $NGINX_CONF)
if ! (grep "location /es/ {" $NGINX_CONF)
then
CONF_MODIFIED=true
echo "setting up ES access in nginx"
cat >>/tmp/nginx_snipet <<END
cat >>/tmp/nginx_snippet <<END
# give access to ES through this url
location /es/ {
Expand All @@ -45,7 +45,7 @@ END
fi
if [ "$CONF_MODIFIED" == "true" ]
then
sed -i "/^ *access_log .*/r /tmp/nginx_snipet" $NGINX_CONF
sed -i "/^ *access_log .*/r /tmp/nginx_snippet" $NGINX_CONF
fi

exec "$@"

0 comments on commit bff5a84

Please sign in to comment.