-
Notifications
You must be signed in to change notification settings - Fork 419
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
Allow storing the registry password in a file #360
base: master
Are you sure you want to change the base?
Conversation
This lets you mount the registry password in a secret that is kept separate from regular configuration. Also it means that the password can be updated dynamically without restarting the process.
this is what #348 was supposed to be but that ended up just being an empty PR due a bot automatically updating my fork of this repo |
if c.config.PasswordFile != "" { | ||
passwordBytes, err := ioutil.ReadFile(c.config.PasswordFile) | ||
if err == nil { | ||
return basic.Username, (string)(passwordBytes) |
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.
In Go, it's preferred to typecast by calling T(v), where T is the new type and v is the value:
return basic.Username, string(passwordBytes)
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.
Hi Kieran,
I apologize for the delayed review. I realize there were no tests for the file before you edited it but we want to change this. Can you add a test for the function you're editing?
@kcolford Can you please address the comments to take this PR forward. Thank you. |
@gkeesh7 I'm not sure how you expect these functions to be tested... all this change does is add a little bit of extra code to fetch the secret from a file instead of inline, it feels like one of those situations that's too obvious to test |
Hi @kcolford, I'd suggest writing a unit test where you create a To test the specific case where the registry file is read/missing/etc., you can use the |
This lets you mount the registry password in a secret that is kept separate from regular configuration. Also it means that the password can be updated dynamically without restarting the process.