-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fauna Query Options #441
Fauna Query Options #441
Conversation
if (argv.secret && argv.database) { | ||
// Providing a database and secret are conflicting options. If both are provided, | ||
// it is not clear which one to use. | ||
throw new Error( | ||
"Cannot use both the '--secret' and '--database' options together. Please specify only one.", | ||
); | ||
} else if (argv.role && argv.secret) { | ||
// The '--role' option is not supported when using a secret. Secrets have an | ||
// implicit role. | ||
logger.warn( | ||
"The '--role' option is not supported when using a secret. It will be ignored.", | ||
); | ||
} |
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.
Could probably factor these checks out into command-helpers
and then use that to check everywhere commonQueryOptions
are used. If you agree, as a follow up sounds fine to me.
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.
yup definitely - I'll factor stuff out when I get to updating keys
// export async function ensureDbScopeClient({ scope, version, argv }) { | ||
// const path = scope.split("/"); | ||
|
||
// const { connectionOptions } = await getClient({ version: "4", argv }); | ||
// const { hostname, port, protocol } = new URL(connectionOptions.url); | ||
|
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.
yay
Co-authored-by: echo-bravo-yahoo <[email protected]>
Problem
We will always want to enable a certain set of options for commands that talk to fauna. These options include
url
,secret
,database
androle
. At the moment these are spread around, some defined at the top level of the cli and other kept in thecommonQueryOptions
object.Solution
Consolidate these options in one place and setup some validation on top of them so users are warned if they specify conflicting or redundant args.
Result
It will be easier to wire up just in time db keys for commands that talk to fauna.
Out of Scope
Doing the same things with the
key
commands.Testing
Added new tests to make sure the arg validation works.