Skip to content

fix: add env fallbacks for hardcoded service URLs#589

Merged
realfishsam merged 1 commit into
mainfrom
fix/508-hardcoded-service-urls
May 24, 2026
Merged

fix: add env fallbacks for hardcoded service URLs#589
realfishsam merged 1 commit into
mainfrom
fix/508-hardcoded-service-urls

Conversation

@realfishsam
Copy link
Copy Markdown
Contributor

Fixes #508

@realfishsam
Copy link
Copy Markdown
Contributor Author

PR Review: PASS (NOT VERIFIED)

What This Does

Adds environment variable fallbacks for three hardcoded service URLs: Opinion API/WS URLs in config.ts, the PMXT Router API URL in router/client.ts, and the Polymarket Goldsky subgraph URL. Also extracts two magic numbers (maker/taker trade limits) into named constants.

Blast Radius

  • core/src/exchanges/opinion/config.ts -- Opinion exchange config
  • core/src/router/client.ts -- Router API client (all venues)
  • core/src/subscriber/external/goldsky.ts -- Polymarket subscriber

Findings

  1. Merge conflict with PR fix: update opinion base URL to proxy.opinion.trade:8443 #591: Both PRs modify core/src/exchanges/opinion/config.ts line 1. PR 589 adds process.env.OPINION_API_URL || "https://openapi.opinion.trade/openapi" while PR 591 changes the hardcoded URL to "https://proxy.opinion.trade:8443/openapi". If both merge, the env var name from 589 and the default URL from 591 must both survive. Whichever merges second will need a conflict resolution.

  2. Env var name mismatch with changelog: The changelog (updated in PR 591) documents OPINION_BASE_URL as the env var for Opinion. PR 589 introduces OPINION_API_URL and OPINION_WS_URL instead. Consumers reading the changelog would set the wrong var. The naming should be reconciled.

  3. Router env var PMXT_API_URL is reasonable -- it only sets the default; the constructor still accepts an explicit baseUrl parameter that takes precedence via the ?? operator. No behavioral change when the env var is unset.

  4. Goldsky constant extraction is clean -- pure refactor replacing magic numbers 5 and 20 with named constants, no behavioral change.

PMXT Pipeline Check

  • Field propagation: N/A (no new fields)
  • OpenAPI sync: N/A
  • Type safety: OK

Semver Impact

patch -- env var fallbacks are additive; existing behavior unchanged when vars are unset.

Risk

  • Merge ordering with PR 591 needs manual attention.
  • OPINION_API_URL vs OPINION_BASE_URL naming inconsistency could confuse users.

@realfishsam realfishsam force-pushed the fix/508-hardcoded-service-urls branch from b0fb073 to 8ba89a0 Compare May 24, 2026 15:23
@realfishsam realfishsam merged commit 9b5c177 into main May 24, 2026
8 of 11 checks passed
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.

Magic numbers: Hardcoded service/subgraph URLs and embedded credentials without env fallbacks

1 participant