-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Problem
Currently, when using trix bindgen to generate client code, the TRP endpoint URL is hardcoded in the generated Client (based on the trix.toml config). This creates challenges when you need different endpoints for different environments (e.g., local development vs production deployment).
Current Workarounds
- Manually edit the generated
Clientcode after runningtrix bindgen(not ideal for automation, particularly because these files are regenerated whenever the tx3 file is edited) - Replace URLs and regenerate bindings in CI/CD pipeline before deployment (adds complexity)
Proposed Solution
Add configuration support for environment variables in the TRP profile configuration. This would allow the generated code to read endpoints from environment variables at runtime.
Suggested config format:
[profiles.devnet.trp]
use_env = true
[profiles.devnet.trp.env]
trp_endpoint = "NEXT_PUBLIC_TRP_ENDPOINT"Use Case
- Local development: Use local TRP endpoint (e.g.,
http://localhost:8080) - Production deployment: Use production TRP endpoint via environment variable
- Multiple environments: Easily switch between staging, production, etc. without code changes
Expected Behavior
When use_env = true is set, the generated client code should read the TRP endpoint from the specified environment variable instead of using a hardcoded URL.
It would look something like this:
export const DEFAULT_TRP_ENDPOINT = process.env.NEXT_PUBLIC_TRP_ENDPOINT || "http://localhost:8164";(or warn about missing env variables)
This would eliminate the need for manual code editing or complex CI/CD URL replacement steps.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status