mirror of
https://github.com/System-End/nephthys.git
synced 2026-04-19 16:28:16 +00:00
Fix selfhosted images being served incorrectly (#148)
* Rename HOSTNAME env var to BASE_URL (and document it)
* BASE_URL.rstrip("/")
Prevent errors if you include / in your env var
* Trailing newline
This commit is contained in:
parent
541d131622
commit
2415abd4b1
5 changed files with 11 additions and 5 deletions
|
|
@ -12,5 +12,7 @@ SLACK_MAINTAINER_ID="U..."
|
|||
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/nephthys"
|
||||
SITE_URL="https://summer.hackclub.com"
|
||||
SITE_API_KEY="..."
|
||||
# Title shown in app home:
|
||||
APP_TITLE="helper heidi"
|
||||
APP_TITLE="helper heidi"
|
||||
PROGRAM="summer_of_making"
|
||||
HACK_CLUB_AI_API_KEY="sk-hc-v1-..."
|
||||
BASE_URL="https://..."
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ Note: These steps have to be done by a Workspace Admin (otherwise it will be una
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@ class Environment:
|
|||
or default_log_level
|
||||
)
|
||||
self.log_level_otel = os.environ.get("LOG_LEVEL_OTEL", logging.INFO)
|
||||
self.hostname: str = os.environ.get("HOSTNAME", "https://nephthys.hackclub.com")
|
||||
self.base_url: str = os.environ.get(
|
||||
"BASE_URL", "https://nephthys.hackclub.com"
|
||||
).rstrip("/")
|
||||
|
||||
self.slack_help_channel = os.environ.get("SLACK_HELP_CHANNEL", "unset")
|
||||
self.slack_ticket_channel = os.environ.get("SLACK_TICKET_CHANNEL", "unset")
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ async def get_ticket_status_pie_chart(
|
|||
caption = "Ticket stats"
|
||||
|
||||
if not url:
|
||||
url = f"{env.hostname}/public/binoculars.png"
|
||||
url = f"{env.base_url}/public/binoculars.png"
|
||||
caption = "looks like heidi's scrounging around for tickets in the trash"
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ def get_loading_view(home_type: str):
|
|||
},
|
||||
{
|
||||
"type": "image",
|
||||
"image_url": f"{env.hostname}/public/loading.gif",
|
||||
"image_url": f"{env.base_url}/public/loading.gif",
|
||||
"alt_text": "Loading...",
|
||||
},
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue