-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: added header-key and header-value to pass header if required for wasm clients #227
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #227 +/- ##
==========================================
- Coverage 13.15% 13.07% -0.09%
==========================================
Files 70 70
Lines 17075 17421 +346
==========================================
+ Hits 2247 2277 +30
- Misses 14586 14900 +314
- Partials 242 244 +2 |
@@ -53,6 +54,8 @@ type WasmProviderConfig struct { | |||
ChainName string `json:"-" yaml:"-"` | |||
ChainID string `json:"chain-id" yaml:"chain-id"` | |||
RPCAddr string `json:"rpc-addr" yaml:"rpc-addr"` | |||
HeaderKey string `json:"header-key" yaml:"header-key"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use standard Authorization header key rather using config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Header key may be different for different API endpoints so letting it be set by the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Authorization header is standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not authorization header, but rather may be API key based where some expect in key api-key or some API in authorization etc. If we are only talking about some predefined API please do mention them so it will be tailored to work only for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's specific for now, almost all RPC support authorization from endpoint.
var customTransport *CustomRoundTripper | ||
headers := http.Header{} | ||
if headerKey != "" { | ||
headers.Add(headerKey, headerValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use key from environment variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key or value ?? since other api which used API key in URL are also saved in plain mode in config, it can be done later if you are concerned about security analyzing the benefits and disadvantages of saving key in file.
added headers key/value if provided in config, the key is header-key and value is header-value in config for wasm