Allow starting without Elasticsearch.

This commit is contained in:
Jakub Gocławski 2020-09-09 14:19:52 +02:00
parent 83438a63a4
commit 338ca514af
No known key found for this signature in database
GPG Key ID: DB23479BBC13E2A3

View File

@ -3,6 +3,7 @@
set -e
: "${AUTOWIZARD_JSON:=''}"
: "${ELASTICSEARCH_ENABLED:=true}"
: "${ELASTICSEARCH_HOST:=zammad-elasticsearch}"
: "${ELASTICSEARCH_PORT:=9200}"
: "${ELASTICSEARCH_SCHEMA:=http}"
@ -77,6 +78,9 @@ if [ "$1" = 'zammad-init' ]; then
# es config
echo "changing settings..."
if [ "${ELASTICSEARCH_ENABLED}" == "false" ]; then
bundle exec rails r "Setting.set('es_url', '')"
else
bundle exec rails r "Setting.set('es_url', '${ELASTICSEARCH_SCHEMA}://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}')"
bundle exec rails r "Setting.set('es_index', '${ELASTICSEARCH_NAMESPACE}')"
@ -101,6 +105,7 @@ if [ "$1" = 'zammad-init' ]; then
echo "rebuilding es searchindex..."
bundle exec rake searchindex:rebuild
fi
fi
# chown everything to zammad user
chown -R "${ZAMMAD_USER}":"${ZAMMAD_USER}" "${ZAMMAD_DIR}"