#!/bin/sh
# Run a GitLab rake task as the git user: gitlab-rake gitlab:env:info
cd /usr/share/gitlab || exit
export TMPDIR=/var/lib/gitlab/tmp TMP=/var/lib/gitlab/tmp
export RAILS_ENV="${RAILS_ENV:-production}" EXECJS_RUNTIME=Disabled
if [ "$(id -u)" = 0 ] ; then
	# create secrets for administrative commands run before any service
	/usr/lib/gitlab/gitlab-setup-secrets || exit
	exec /sbin/runuser -u git -- /usr/bin/env TMPDIR="$TMPDIR" TMP="$TMP" /usr/bin/bundle exec rake "$@"
fi
exec /usr/bin/bundle exec rake "$@"
