From 6afc28a27c53d187d965b98a5b8237dbf1e84f8a Mon Sep 17 00:00:00 2001 From: Mish Date: Mon, 26 Jan 2026 18:58:22 +0000 Subject: [PATCH] Make SITE_API_KEY not required (#150) --- .env.sample | 2 -- docs/deployment.md | 4 +--- nephthys/utils/env.py | 9 +++++++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.env.sample b/.env.sample index cd9939c..9e4c81e 100644 --- a/.env.sample +++ b/.env.sample @@ -10,8 +10,6 @@ SLACK_HELP_CHANNEL="C..." SLACK_USER_GROUP="S..." SLACK_MAINTAINER_ID="U..." DATABASE_URL="postgresql://postgres:postgres@localhost:5432/nephthys" -SITE_URL="https://summer.hackclub.com" -SITE_API_KEY="..." APP_TITLE="helper heidi" PROGRAM="summer_of_making" HACK_CLUB_AI_API_KEY="sk-hc-v1-..." diff --git a/docs/deployment.md b/docs/deployment.md index c91d0bd..6b09b6a 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -73,13 +73,11 @@ Note: These steps have to be done by a Workspace Admin (otherwise it will be una APP_TITLE="Heidi the Assistant" # Hack Club AI API key for generating ticket titles (highly recommended) HACK_CLUB_AI_API_KEY="sk-hc-v1-..." - # Set this to anything - SITE_API_KEY="none" # Set this to the URL where the site will be hosted BASE_URL="https://summer.nephthys.hackclub.com" ``` - - `SITE_API_KEY` (and `SITE_URL`) are only used for generating magic links for Summer of Making, so they don't have to be included (but `SITE_API_KEY` must be set due to a bug) + - `SITE_API_KEY` (and `SITE_URL`) are only used for generating magic links for Summer of Making, so they don't have to be included 3. There's more optional environment variables that you can set, which I shall document here: diff --git a/nephthys/utils/env.py b/nephthys/utils/env.py index 9a9199f..c98b50c 100644 --- a/nephthys/utils/env.py +++ b/nephthys/utils/env.py @@ -22,10 +22,15 @@ class Environment: self.slack_app_token = os.environ.get("SLACK_APP_TOKEN") self.uptime_url = os.environ.get("UPTIME_URL") - self.site_url = os.environ.get("SITE_URL", "https://summer.hackclub.com") - self.site_api_key = os.environ.get("SITE_API_KEY", "unset") self.hack_club_ai_api_key = os.environ.get("HACK_CLUB_AI_API_KEY") + self.site_url = os.environ.get("SITE_URL") + self.site_api_key = os.environ.get("SITE_API_KEY") + if self.site_url and not self.site_api_key: + raise ValueError( + "SITE_API_KEY must be set if SITE_URL is set to generate magic links" + ) + self.otel_logs_url = os.environ.get("OTEL_EXPORTER_OTLP_LOGS_ENDPOINT") self.otel_service_name = os.environ.get("OTEL_SERVICE_NAME", "nephthys") # Allows easily providing HTTP Basic Auth credentials formatted as user:pass