sourcebot/entrypoint.sh

38 lines
1.2 KiB
Bash
Raw Normal View History

2024-08-31 01:36:53 +00:00
#!/bin/sh
set -e
2024-09-06 19:19:55 +00:00
# Check if CONFIG_PATH is set
if [ -z "$CONFIG_PATH" ]; then
echo "\e[33mWarning: CONFIG_PATH environment variable is not set.\e[0m"
fi
2024-08-31 01:36:53 +00:00
# Check if GITHUB_TOKEN is set
if [ -n "$GITHUB_TOKEN" ]; then
echo "$GITHUB_TOKEN" > "$HOME/.github-token"
chmod 600 "$HOME/.github-token"
2024-08-31 01:36:53 +00:00
# Configure Git with the provided GITHUB_TOKEN
echo "machine github.com
login oauth
password ${GITHUB_TOKEN}" >> "$HOME/.netrc"
chmod 600 "$HOME/.netrc"
2024-08-31 01:36:53 +00:00
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"
# Configure Git with the provided GITLAB_TOKEN
echo "machine gitlab.com
login oauth
password ${GITLAB_TOKEN}" >> "$HOME/.netrc"
chmod 600 "$HOME/.netrc"
2024-09-04 20:55:47 +00:00
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
exec supervisord -c /etc/supervisor/conf.d/supervisord.conf