diff --git a/docker/config.sh b/docker/config.sh index fc771491..356e9d78 100755 --- a/docker/config.sh +++ b/docker/config.sh @@ -1,30 +1,35 @@ #!/bin/sh -if ! grep -q "host.docker.internal" /etc/hosts; then - echo "host.docker.internal has to be in your hosts-file, to add you need sudo privileges" - sudo sh -c 'echo "127.0.0.1 host.docker.internal" >> /etc/hosts' +UPDATE_HOSTS=${HAS_SUDO:-true} + +if [ "$UPDATE_HOSTS" = "true" ] && ! grep -q "search.uitdatabank.local" /etc/hosts; then + echo "search.uitdatabank.local has to be in your hosts-file, to add you need sudo privileges" + sudo sh -c 'echo "127.0.0.1 search.uitdatabank.local" >> /etc/hosts' fi -DIR="../appconfig/files/uitdatabank/docker/udb3-search-service/" +APPCONFIG_ROOTDIR=${APPCONFIG:-'../appconfig'} +GEOJSON_DATA_ROOTDIR=${GEOJSON_DATA:-'../geojson-data'} + +DIR="${APPCONFIG_ROOTDIR}/files/uitdatabank/docker/udb3-search-service/" if [ -d "$DIR" ]; then cp -R "$DIR"/* . else - echo "Error: missing appconfig. The appconfig and udb3-search-service repositories must be cloned into the same parent folder." + echo "Error: missing appconfig. The appconfig repository must be cloned at ${APPCONFIG_ROOTDIR}." exit 1 fi -DIR="../appconfig/files/uitdatabank/docker/keys/" +DIR="${APPCONFIG_ROOTDIR}/files/uitdatabank/docker/keys/" if [ -d "$DIR" ]; then cp -R "$DIR"/* . else - echo "Error: missing appconfig. The appconfig and udb3-search-service repositories must be cloned into the same parent folder." + echo "Error: missing appconfig. The appconfig repository must be cloned at ${APPCONFIG_ROOTDIR}." exit 1 fi -DIR="../geojson-data/output" +DIR="${GEOJSON_DATA_ROOTDIR}/output" if [ -d "$DIR" ]; then cp "$DIR"/facet_mapping_regions.yml . else - echo "Error: missing geojson data. See docker.md prerequisites to fix this." + echo "Error: missing geojson-data. The geojson-data repository must be cloned at ${GEOJSON_DATA_ROOTDIR}." exit 1 -fi \ No newline at end of file +fi