docs: add examples for NewStoreFromDocker and NewStoreWithFallbacks#55
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #55 +/- ##
=======================================
Coverage 81.13% 81.13%
=======================================
Files 6 6
Lines 371 371
=======================================
Hits 301 301
Misses 48 48
Partials 22 22
|
| ) | ||
|
|
||
| func ExampleNewStoreFromDocker() { | ||
| ds, err := credentials.NewStoreFromDocker(credentials.StoreOptions{AllowPlaintextPut: true}) |
There was a problem hiding this comment.
Let's format the code in standard go style.
| ds, err := credentials.NewStoreFromDocker(credentials.StoreOptions{AllowPlaintextPut: true}) | |
| ds, err := credentials.NewStoreFromDocker(credentials.StoreOptions{ | |
| AllowPlaintextPut: true, | |
| }) |
There was a problem hiding this comment.
same for the other example
| err = ds.Put(context.Background(), "localhost:8080", | ||
| auth.Credential{ | ||
| Username: "username-example", | ||
| Password: "password-example"}) |
There was a problem hiding this comment.
| err = ds.Put(context.Background(), "localhost:8080", | |
| auth.Credential{ | |
| Username: "username-example", | |
| Password: "password-example"}) | |
| err = ds.Put(context.Background(), "localhost:8080", auth.Credential{ | |
| Username: "username-example", | |
| Password: "password-example", | |
| }) |
There was a problem hiding this comment.
same for the other example
| // get credentials from the store | ||
| cred, err := sf.Get(context.Background(), "localhost:8080") | ||
| if err != nil { | ||
| panic(err) | ||
| } | ||
| fmt.Println(cred) |
There was a problem hiding this comment.
Getting from fallback store is not demonstrated.
There was a problem hiding this comment.
Changed the function name to ExampleNewStoreWithFallbacks_configAsPrimaryStoreDockerAsFallback to demonstrate the scenario.
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Resolves #49