Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check environment variable for transit relay server #281

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kernelPanic0x
Copy link
Contributor

Add environment variable support for relay server configuration

Add the env feature to clap and allow setting relay servers via the WORMHOLE_RELAY_SERVER environment variable in addition to the --relay-server CLI flag.

I'm using my own relay server for improved speed and to reduce load on the public default relay server. By adding environment variable support, I can configure it once and forget about it instead of having to specify it on every wormhole invocation.

Changes

  • Enable env feature in clap
  • Add environment variable support for relay server configuration via WORMHOLE_RELAY_SERVER

Testing

The relay server can now be configured via:

  1. --relay-server CLI flag (highest priority)
  2. WORMHOLE_RELAY_SERVER environment variable

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 37.59%. Comparing base (bee63ed) to head (6f5adf0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #281      +/-   ##
==========================================
- Coverage   37.69%   37.59%   -0.10%     
==========================================
  Files          19       19              
  Lines        3221     3221              
==========================================
- Hits         1214     1211       -3     
- Misses       2007     2010       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@felinira
Copy link
Collaborator

I think this could be compatible with the original python implementation just by renaming the variable

https://github.com/magic-wormhole/magic-wormhole/blob/master/src/wormhole/cli/cli.py#L93

This makes it a little inconsistent with the parameter, but it might be worth it.

@kernelPanic0x
Copy link
Contributor Author

I think this could be compatible with the original python implementation just by renaming the variable

https://github.com/magic-wormhole/magic-wormhole/blob/master/src/wormhole/cli/cli.py#L93

This makes it a little inconsistent with the parameter, but it might be worth it.

I have also added WORMHOLE_TRANSIT_HELPER... would it be better to rename --rendezvous-server to --transit-server for compatibility too?

@felinira
Copy link
Collaborator

would it be better to rename --rendezvous-server to --transit-server for compatibility too?

Actually, in python, the TRANSIT_HELPER is the relay server, and the RELAY_URL is the mailbox rendezvous server. This is all more confusing than I thought.

You know what? Maybe this was a bad suggestion by me, and the original name you had was much better 😂

Let's forgo compatibility, and stay with the original names derived from the command line arguments 🙈

@meejah
Copy link
Member

meejah commented Dec 17, 2024

I'm not opposed to changing the Python env-vars ... something with "Mailbox" in it is my preference for the mailbox server...

I would keep backwards-compat for a release or two in Python somehow .. but --mailbox-url or --mailbox with corresponding WORMHOLE_MAILBOX (or WORMHOLE_MAILBOX_URL) makes a lot of sense to me.

In any case, I find "relay" to be confusing especially because there is a different / related server that actually relays traffic 🤪

@kernelPanic0x
Copy link
Contributor Author

So technically the mailbox server is called rendezvous server right? Should we rename the command line arg to --mailbox-url and --relay-url and the corresponding code/variable names too or is it fine for now?

@meejah
Copy link
Member

meejah commented Dec 17, 2024

So technically the mailbox server is called rendezvous server right?

It has been called both (and also "relay") but I'm trying to "standardize" on "Mailbox Server", approximately (as it fits with the analogies in the documentation / specifications better, among other reasons).

I will change the Python CLI to match

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.

3 participants