-
Notifications
You must be signed in to change notification settings - Fork 2
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
Added the ability to work with secrets in the CLI. set, delete and get list of all secrets keys, per region. #100
Conversation
…t list of all secrets keys, per region.
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.
Very good job, now lets get it perfect.
src/commands/code/secret.ts
Outdated
value = await PromptService.promptForHiddenInput( | ||
'value', | ||
'Enter value for secret variable', | ||
'You must enter a value value', |
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.
"value value"
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.
It was also in env.ts. Fix that for both
src/commands/code/secret.ts
Outdated
key = await promptForKeyIfNotProvided(mode, appId, key); | ||
value = await promptForValueIfNotProvided(mode, value); | ||
this.preparePrintCommand(this, { appId, mode, key, value, region: selectedRegion }); | ||
console.log("1") |
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.
as you can see here, and further down the road, it's a best practice to use the commit modal in Webstorm and "cherry pick" specific changes that would go on the commit, reverting unwanted things like console logs or leaving them un-commited locally just for debugging.
If you're not familiar with that, lets sit together for 10 mins.
also, you see our code base has automatically enforced standarts- below you see an automatic message for lint/prettier errors - using double quotes "" instead of single quotes ''.
But anyway, to "pass the code-review" you'll have to do some fixes, start by removing all the unneeded console logs.
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.
Got it, i'm writing to me to talk with you about the "cherry pick".
src/consts/manage-app-secret.ts
Outdated
LIST_KEYS = 'list-keys', | ||
SET = 'set', | ||
DELETE = 'delete', | ||
} |
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.
this is identical to what we have in "Env" - is there any reason to duplicate this file and contents, instead of re-using what we already have?
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.
I though that it will be the best to separate between those two action, because maybe in the future we would like to change some management mode only for one of them and not for the other. Let me know if you still think this duplication isn't necessary.
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.
I understand, but this goes for everything really- but for types, interfaces, enums, consts and things that are "general" (i.e not business logic code) - we try to re-use what we can.
If we need to in the future, we can expand on that.
|
||
import { listAppSecretKeysResponseSchema } from 'services/schemas/manage-app-secret-service-schemas'; | ||
|
||
export type ListAppSecretKeysResponse = z.infer<typeof listAppSecretKeysResponseSchema>; |
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.
did you get a chance to look at some Zod documentation?
do you understand what this line of code does?
If not, it's a good example of something simple you can give to AI like ChatGPT and get some explanations of these under-the-hood operations. 🔍
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.
I read about Zod earlier. I added to my "todo list" to go through the documentation deeper.
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.
I dont see a great value in going over the documentation in general- BUT- try to look through the CLI project and see usages of zod for validation, and definitions of zod schemas. If something isn't super-clear from the code, look it up in the documentation.
Specifically for this line that is the intention, because it uses a couple of typescript + zod magic tricks - so just make sure it makes sense for you.
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.
LGTM 🚀
No description provided.