-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: add token flag #79
Conversation
Signed-off-by: Navendu Pottekkat <[email protected]>
@lingsamuel I seem to get the same errors when I run the tests from master branch as well. |
let me check it |
cmd/configure.go
Outdated
@@ -168,11 +176,11 @@ func saveConfiguration(cmd *cobra.Command) error { | |||
|
|||
if rootConfig.Token == "" || overwrite { | |||
fmt.Println("Please enter the APISIX token: ") | |||
token, err := reader.ReadString('\n') | |||
byteToken, err := term.ReadPassword(0) |
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.
- if is terminal, use
syscall.Stdin
instead of 0 - if not, handle tty is 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.
Changed to use syscall.Stdin
.
No. master CI is working as expected. Maybe some dependency conflict in this PR. |
Signed-off-by: Navendu Pottekkat <[email protected]>
Anything obvious? |
no |
It seems like the issue is with the hidden input for the token. |
|
Wait till #85 |
b31d99a
to
4755f18
Compare
TTY should be handled in this PR. Otherwise this PR is actually a breaking change because the users cannot configure adc without user-input anymore. |
Signed-off-by: Navendu Pottekkat <[email protected]>
@lingsamuel Thank you for pointing that out. Added a check for terminals, and if not, fall back to the previous way we handled the input. The tests are passing, so it should be backward compatible now, right? |
* feat: add token flag and hide token input Signed-off-by: Navendu Pottekkat <[email protected]> * use syscall.stdin Signed-off-by: Navendu Pottekkat <[email protected]> * fix: handle non-terminal environments Signed-off-by: Navendu Pottekkat <[email protected]> --------- Signed-off-by: Navendu Pottekkat <[email protected]>
Description
Adds a
--token
flag to pass the token in non-interactive environments.Also hides the token input in a standard way by not showing anything in the terminal when a user inputs the token during the prompt.
Checklist