Skip to content

Conversation

@aelxxs
Copy link
Contributor

@aelxxs aelxxs commented Apr 17, 2025

Corrects logic for loading various fields from environment variables in the configuration loader.

Previously, some fields (e.g. Presence, Shard Count)—were only set when JSON unmarshalling or parsing failed, causing valid configuration values to be ignored.

err := json.Unmarshal([]byte(v), &presence)

// Before
if err != nil { // ← WRONG: Set when invalid
	c.Presence = presence
}

// After
if err == nil { // ← CORRECT: Set when valid
	c.Presence = presence
}

Affected Fields:

  • DISCORD_PRESENCE,
  • DISCORD_SHARD_IDS
  • Numeric Fields: DISCORD_RAW_INTENTS, DISCORD_GATEWAY_VERSION, etc.

@appellation appellation self-requested a review April 17, 2025 18:10
@appellation appellation merged commit 2b8d706 into spec-tacles:master Apr 17, 2025
0 of 2 checks passed
@aelxxs aelxxs deleted the fix/bug-with-env-config-loading branch April 17, 2025 20:16
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.

2 participants