From fed2f75a28b3f47ca2ff3f63afae5f1ecd00743f Mon Sep 17 00:00:00 2001 From: bkellam Date: Fri, 27 Sep 2024 23:38:32 -0700 Subject: [PATCH] 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 --- Dockerfile | 2 +- entrypoint.sh | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94d60de1..71bd631d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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. diff --git a/entrypoint.sh b/entrypoint.sh index 9b6e6fca..2c589efa 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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.