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

Support running commands against container. #447

Merged
merged 8 commits into from
Dec 3, 2024
Merged

Support running commands against container. #447

merged 8 commits into from
Dec 3, 2024

Conversation

cleve-fauna
Copy link
Contributor

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

Ticket(s): FE-5990

Problem

Customers need to easily run CLI commands against a Fauna container. This is useful when they run tests, configure developer environments, etc.

Solution

Long term we'll do this by:

  • adding a local flag to indicate running against a local fauna
  • adapting url based on presence of local flag. URL is set to localhost:8443 if nourl is passed in.
  • setting secret to 'secret' if no explicit secret is passed in
  • using the Fauna API instead of frontdoor for appropriate commands
  • fast suceeding logins and other account API specific commands

Start work to support this by:

  • adding a local flag to indicate running against a local fauna
  • adapting url based on presence of local flag. URL is set to localhost:8443 if nourl is passed in.

I made this happen by replacing the usage of the object spread syntax with a function call when setting up common arguments. i.e.

yargs.options({
...commonQueryOptions,
...otherOptions
})

is now

yargsWithCommonQueryOptions(yargs).options(otherOptions)

This allows us to do the URL adapting.

I will do this over several PRs. This PR is very bare bones; it does the above and nothing else. Over the next few PRs I will also add:

  • setting secret to 'secret' if no explicit secret is passed in
  • using the Fauna API instead of frontdoor for appropriate commands
  • fast suceeding logins and other account API specific commands

Result

The big change here is that I added a new way to inject the "common options". We need to do this by calling a function now instead of using the object spread syntax when building yargs.

Testing

Added tests to confirm URL setting works as expected.

Ran the existing tests. My goal with this PR is to ship this new means of yargs construction so this work does not drift from v3.

@cleve-fauna cleve-fauna marked this pull request as ready for review December 3, 2024 12:57
@cleve-fauna cleve-fauna requested a review from a team as a code owner December 3, 2024 12:57
@cleve-fauna cleve-fauna requested a review from a team December 3, 2024 14:14
@cleve-fauna cleve-fauna merged commit 1153265 into v3 Dec 3, 2024
4 checks passed
@cleve-fauna cleve-fauna deleted the v3_notSure branch December 3, 2024 14:19
@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.

3 participants