feat(config): add PUBLIC_URL for bot status dashboard link#97
Open
webframp wants to merge 3 commits intocalesthio:masterfrom
Open
feat(config): add PUBLIC_URL for bot status dashboard link#97webframp wants to merge 3 commits intocalesthio:masterfrom
webframp wants to merge 3 commits intocalesthio:masterfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
/statuscommand in both Telegram and Discord bots always showshttp://localhost:PORTas 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_URLenvironment variable. When set, bot status responses use it instead of the hardcoded localhost URL. Falls back tohttp://localhost:PORTwhen unset, so existing setups are unaffected.Changes
crucix.config.mjs: AddedpublicUrlconfig property fromPUBLIC_URLenv varserver.mjs: Updated both Telegram and Discord/statushandlers to useconfig.publicUrlwith localhost fallbackUsage
# .env PUBLIC_URL=https://my-crucix.example.comThe
/statuscommand then shows:Also worth adding to
.env.exampleif accepted — happy to amend.