-
Notifications
You must be signed in to change notification settings - Fork 16
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
Store a ShellConfig in FaunaCommand #252
Conversation
e346896
to
8102739
Compare
c2a0ae6
to
2e13d99
Compare
61d26da
to
297436b
Compare
validate = () => { | ||
if (this.endpoint === undefined) { | ||
// No `~/.fauna-shell` was found, and no `--secret` was passed. | ||
throw new Error( | ||
"No endpoint or secret set. Set an endpoint in ~/.fauna-shell, .fauna-project, or pass --endpoint" | ||
); | ||
} | ||
}; |
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.
we do almost all of the validation in the constructor for this class and then just do the endpoint in the validate method. It seems that we are doing it this way because some commands don't require an endpoint. Which ones are those?
Given that it seems we are saying that this class is technically 'valid' without an endpoint. With that, I think I'd rather have the code paths that need it ensure there is an endpoint without this method on this class.
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, this should be renamed and refactored a bit to move more validation into here. i'll do that in a future PR
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.
other than my one minor comment, LGTM
…ts can use ShellConfig without setting an endpoint
297436b
to
5ad39e4
Compare
Ticket(s): FE-###
Stores a
ShellConfig
inFaunaCommand
, which will let us use the config in all the commands that need it.