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

FE-5990 Set argv.secret to 'secret' when --local passed in and --secret is not. Always respect argv.secret when getting a secret with FaunaClient.getSecret. #449

Merged
merged 8 commits into from
Dec 3, 2024

Conversation

cleve-fauna
Copy link
Contributor

@cleve-fauna cleve-fauna commented Dec 3, 2024

Ticket(s): FE-5990

Problem

--local must set up user to user a local container. This means:

  1. Set url to http://localhost:8443 if no explicit --url is provided.
  2. Set secret to secret if no explicit --secret is provided.
  3. Call container, and not the account API, for list databases, create key
  4. Fast return account API commands like login.

(1) is already shipped.

This PR implements (2).

Additionally, I noticed that we were not respecting argv.secret in query or shell. This PR fixes that.

Solution

I updated the coercion based on local's present to set argv.secret if no explicit secret is given.

Result

Users can easy use a default Fauna container; and can tweak it with a custom secret or URL

Out of Scope

  1. Abnegating the use of the account API when --local is passed.
  2. Fast-completing account API commands like login

Testing

  • Ran the full suite.
  • Ran the linter.

…et is not. Always respect argv.secret when getting a secret with FaunaClient.getSecret.
@cleve-fauna cleve-fauna requested a review from a team as a code owner December 3, 2024 14:39
@cleve-fauna cleve-fauna requested a review from a team December 3, 2024 14:49
@cleve-fauna cleve-fauna requested a review from wildemat December 3, 2024 14:53
@cleve-fauna cleve-fauna merged commit 33ea345 into v3 Dec 3, 2024
4 checks passed
@cleve-fauna cleve-fauna deleted the v3_setSecretOnLocal branch December 3, 2024 16:45
Comment on lines +107 to +118
.middleware((argv) => {
if (!argv.url) {
if (argv.local) {
argv.url = 'http://localhost:8443';
} else {
argv.url = 'https://db.fauna.com';
}
}
if (!argv.secret && argv.local) {
argv.secret = "secret";
}
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you move this into a function, we can unit test it as an individual middleware.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do. i love my end to end tests tho.

@cleve-fauna cleve-fauna mentioned this pull request Dec 5, 2024
This was referenced Dec 6, 2024
@cleve-fauna cleve-fauna mentioned this pull request Dec 13, 2024
@wildemat wildemat mentioned this pull request Dec 18, 2024
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.

None yet

4 participants