Skip to content

Commit 23bab30

Browse files
committed
Note an alternative approach to bbolt-only fallback
Not sure why I didn't think of this the first time, rather than the wild approach I took with all the init functions. Maybe I was hesitant to not follow the common error handling path, even though it's not relevant. I still don't want to do this, though. The code is simpler, but the concept is still hard to explain.
1 parent d0f9c4e commit 23bab30

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/store/store.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ func FactoryFromEnv(ctx context.Context) (Factory, error) {
4343
if len(registry.Registry) == 0 {
4444
return nil, errors.New("no store backends available in this build")
4545
}
46+
// If we wanted, we could do this to fall back to bbolt if it were the only
47+
// thing linked into the binary:
48+
// if len(registry.Registry) == 1 {
49+
// if bbolt, ok := registry.Registry["bbolt"]; ok {
50+
// return bbolt.FactoryFromEnv(ctx)
51+
// }
52+
// }
4653

4754
candidates := make(map[string]registry.Entry)
4855
for name, entry := range registry.Registry {

0 commit comments

Comments
 (0)