Skip to content

feat(config): add PUBLIC_URL for bot status dashboard link#97

Open
webframp wants to merge 3 commits intocalesthio:masterfrom
webframp:feat/public-url-config
Open

feat(config): add PUBLIC_URL for bot status dashboard link#97
webframp wants to merge 3 commits intocalesthio:masterfrom
webframp:feat/public-url-config

Conversation

@webframp
Copy link
Copy Markdown

Problem

The /status command in both Telegram and Discord bots always shows http://localhost:PORT as the dashboard URL. When Crucix is deployed on a remote server or behind a reverse proxy, this link is unreachable for users.

Solution

Adds an optional PUBLIC_URL environment variable. When set, bot status responses use it instead of the hardcoded localhost URL. Falls back to http://localhost:PORT when unset, so existing setups are unaffected.

Changes

  • crucix.config.mjs: Added publicUrl config property from PUBLIC_URL env var
  • server.mjs: Updated both Telegram and Discord /status handlers to use config.publicUrl with localhost fallback

Usage

# .env
PUBLIC_URL=https://my-crucix.example.com

The /status command then shows:

Dashboard: https://my-crucix.example.com

Also worth adding to .env.example if accepted — happy to amend.

exe.dev user and others added 3 commits April 20, 2026 04:16
The custom .env parser did not handle quoted values, causing passwords
and API keys containing special characters (|, ^, ", >, [, etc.) to
include the quote characters as part of the value or parse incorrectly.

This adds quote stripping for both single and double-quoted values,
matching the behavior of dotenv and other standard .env parsers.

Co-authored-by: Shelley <shelley@exe.dev>
Slash command registration was called before client.login(), so
client.user.id was undefined and fell back to the string "me",
causing a Discord API error:

  Invalid Form Body
  application_id[NUMBER_TYPE_COERCE]: Value "me" is not snowflake.

This moves command registration into the ready event handler and
attaches that handler before login() to avoid a race condition
where the ready event fires before the listener is attached.

Co-authored-by: Shelley <shelley@exe.dev>
When running behind a reverse proxy or on a remote host, the /status
command in Telegram and Discord shows http://localhost:PORT which is
not reachable by users.

Adds a PUBLIC_URL env var that, when set, replaces the hardcoded
localhost URL in bot status responses. Falls back to localhost when
unset, so existing setups are unaffected.

Example: PUBLIC_URL=https://my-crucix.example.com
Co-authored-by: Shelley <shelley@exe.dev>
@webframp webframp requested a review from calesthio as a code owner April 20, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant