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

fix: move x-api-key logic to middlewares #1052

Merged
merged 1 commit into from Mar 9, 2023

Conversation

xilosada
Copy link
Contributor

@xilosada xilosada commented Mar 4, 2023

fixes #1051
The current implementation of the Near CLI that sets the x-api-key value in the yargs config. This approach ignores the nodeUrl option passed to the commands. It makes it difficult to manage custom RPCs since the x-api-key is bound to the nodeUrl in the config.

The proposed solution sets the x-api-key value in a middleware instead of the config file. This middleware applies the actual nodeUrl value passed to the command.

@xilosada xilosada marked this pull request as ready for review March 4, 2023 19:52
@xilosada xilosada changed the title fix: move getXApi key to middlewares fix: move XApi key logic to middlewares Mar 5, 2023
@xilosada xilosada changed the title fix: move XApi key logic to middlewares fix: move XApiKey logic to middlewares Mar 5, 2023
@xilosada xilosada changed the title fix: move XApiKey logic to middlewares fix: move x-api-key logic to middlewares Mar 5, 2023
@xilosada xilosada force-pushed the use_middleware_to_set_apkikey branch from f422a97 to dd7f04f Compare March 5, 2023 08:09
@DavidM-D DavidM-D requested a review from volovyks March 7, 2023 11:22
@volovyks
Copy link
Collaborator

volovyks commented Mar 7, 2023

No objections here, but I want to see green CI. We need to setup tests for external contributors (I do not have the rights). I will ping somebody to change it.

@chefsale
Copy link
Contributor

chefsale commented Mar 7, 2023

@volovyks any update on this one :)

@ailisp
Copy link
Member

ailisp commented Mar 8, 2023

Hi @xilosada we just enabled ci for PR from fork. Please merge current master to your branch and that will trigger CI!

@xilosada xilosada force-pushed the use_middleware_to_set_apkikey branch from dd7f04f to 394cc9c Compare March 8, 2023 15:28
@ailisp ailisp merged commit 4649d5e into near:master Mar 9, 2023
@ailisp
Copy link
Member

ailisp commented Mar 9, 2023

Nice fix! Thank you @xilosada!

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.

x-api-key is not added to the request headers if the nodeUrl is passed as option
4 participants