sourcebot/entrypoint.zoekt-indexserver.sh

25 lines
981 B
Bash
Raw Normal View History

2024-08-31 01:36:53 +00:00
#!/bin/sh
set -e
# Check if GITHUB_TOKEN is set
if [ -n "$GITHUB_TOKEN" ]; then
echo "$GITHUB_TOKEN" > "$HOME/.github-token"
chmod 600 "$HOME/.github-token"
# Configure Git with the provided GITHUB_TOKEN
# @see : https://github.com/sourcegraph/zoekt/issues/578#issuecomment-1519369619
git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadof "https://github.com"
else
echo -e "\e[33mWarning: Private GitHub repositories will not be indexed since GITHUB_TOKEN was not set. If you are not using GitHub, disregard.\e[0m"
fi
2024-09-04 20:55:47 +00:00
# Check if GITLAB_TOKEN is set
if [ -n "$GITLAB_TOKEN" ]; then
echo "$GITLAB_TOKEN" > "$HOME/.gitlab-token"
chmod 600 "$HOME/.gitlab-token"
else
echo -e "\e[33mWarning: GitLab repositories will not be indexed since GITLAB_TOKEN was not set. If you are not using GitLab, disregard.\e[0m"
fi
2024-09-01 02:30:28 +00:00
exec "zoekt-indexserver" "-data_dir" "${ZOEKT_DATA_CACHE_DIR}" "-mirror_config" "${CONFIG_PATH}"