Changed things s.t., /data/config.json is the default config path. If a file cannot be found at that path, a warning is issued and we fallback on ./sample-config.json

This commit is contained in:
bkellam 2024-09-27 23:38:32 -07:00
parent d45a9bcd46
commit fed2f75a28
2 changed files with 9 additions and 6 deletions

View file

@ -32,7 +32,7 @@ WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV DATA_DIR=/data
ENV CONFIG_PATH=$DATA_DIR/sample-config.json
ENV CONFIG_PATH=$DATA_DIR/config.json
ENV DATA_CACHE_DIR=$DATA_DIR/.sourcebot
# Sourcebot collects anonymous usage data using [PostHog](https://posthog.com/). Uncomment this line to disable.

View file

@ -1,11 +1,14 @@
#!/bin/sh
set -e
# Check if CONFIG_PATH is set
if [ -z "$CONFIG_PATH" ]; then
echo "\e[33mWarning: CONFIG_PATH environment variable is not set.\e[0m"
# Fallback to sample config if a config does not exist
if [ ! -f "$CONFIG_PATH" ]; then
echo -e "\e[33m[Warning] Config file at CONFIG_PATH not found. Falling back on sample config.\e[0m"
CONFIG_PATH="./sample-config.json"
fi
echo -e "\e[34m[Info] Using config file at: '$CONFIG_PATH'.\e[0m"
# Check if GITHUB_TOKEN is set
if [ -n "$GITHUB_TOKEN" ]; then
echo "$GITHUB_TOKEN" > "$HOME/.github-token"
@ -17,7 +20,7 @@ if [ -n "$GITHUB_TOKEN" ]; then
password ${GITHUB_TOKEN}" >> "$HOME/.netrc"
chmod 600 "$HOME/.netrc"
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"
echo -e "\e[34m[Info] Private GitHub repositories will not be indexed since GITHUB_TOKEN was not set.\e[0m"
fi
# Check if GITLAB_TOKEN is set
@ -31,7 +34,7 @@ if [ -n "$GITLAB_TOKEN" ]; then
password ${GITLAB_TOKEN}" >> "$HOME/.netrc"
chmod 600 "$HOME/.netrc"
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"
echo -e "\e[34m[Info] GitLab repositories will not be indexed since GITLAB_TOKEN was not set.\e[0m"
fi
# Update nextjs public env variables w/o requiring a rebuild.