diff --git a/gitlab-workhorse/scripts/start-workhorse b/gitlab-workhorse/scripts/start-workhorse index 560a4b30cd1ceab55079d1d3b61ed78fbf257a50..1622c88ed178b193ae3384edc52c844c8b86a9b2 100755 --- a/gitlab-workhorse/scripts/start-workhorse +++ b/gitlab-workhorse/scripts/start-workhorse @@ -14,6 +14,23 @@ if [[ "${GITLAB_WORKHORSE_PROM_LISTEN_ADDR}" =~ ^.+:[0-9][0-9]{0,4}$ ]]; then export PROM_LISTEN_ADDR="-prometheusListenAddr ${GITLAB_WORKHORSE_PROM_LISTEN_ADDR}" fi +# option to append/overwrite robot.txt +if [[ ! -z "${ROBOTSTXT_CONFIG_MOUNT_PATH}" ]]; then + ROBOTS_TXT_APPEND_FILE="${ROBOTS_TXT_APPEND_FILE:-$ROBOTSTXT_CONFIG_MOUNT_PATH/robots_append.txt}" + ROBOTS_TXT_OVERWRITE_FILE="${ROBOTS_TXT_OVERWRITE_FILE:-$ROBOTSTXT_CONFIG_MOUNT_PATH/robots_overwrite.txt}" +else + ROBOTS_TXT_APPEND_FILE="${ROBOTS_TXT_APPEND_FILE:-$TMPDIR/robots_append.txt}" + ROBOTS_TXT_OVERWRITE_FILE="${ROBOTS_TXT_OVERWRITE_FILE:-$TMPDIR/robots_overwrite.txt}" +fi + +export ROBOTS_TXT_FILE=/srv/gitlab/public/robots.txt + +if [ -f "${ROBOTS_TXT_APPEND_FILE}" ] && [ -r "${ROBOTS_TXT_APPEND_FILE}" ]; then + cat ${ROBOTS_TXT_APPEND_FILE} >> ROBOTS_TXT_FILE +elif [ -f "${ROBOTS_TXT_OVERWRITE_FILE}" ] && && [ -r "${ROBOTS_TXT_OVERWRITE_FILE}" ]; then + cat ${ROBOTS_TXT_OVERWRITE_FILE} > ROBOTS_TXT_FILE +fi + gitlab-workhorse \ -logFile ${GITLAB_WORKHORSE_LOG_FILE} \ -logFormat ${GITLAB_WORKHORSE_LOG_FORMAT} \