uber / kraken

P2P Docker registry capable of distributing TBs of data in seconds
Apache License 2.0
6.13k stars 422 forks source link

Allow storing the registry password in a file #360

Open kcolford opened 4 months ago

kcolford commented 4 months ago

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.

kcolford commented 3 months ago

this is what https://github.com/uber/kraken/pull/348 was supposed to be but that ended up just being an empty PR due a bot automatically updating my fork of this repo

gkeesh7 commented 2 months ago

@kcolford Can you please address the comments to take this PR forward.

Thank you.

kcolford commented 1 month ago

@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

Anton-Kalpakchiev commented 1 week ago

Hi @kcolford, I'd suggest writing a unit test where you create a credentialStore with appropriate values. Then you run the function and assert that its return values are as expected.

To test the specific case where the registry file is read/missing/etc., you can use the os package's CreateTemp function to create a temporary file, which you can then fill with whatever values the test requires. The test would delete the file at the end.