Isolate runner object store construction
This commit is contained in:
@@ -13,7 +13,15 @@ func newCommandObjectStore(ctx context.Context, cfg *config.Config, logger *slog
|
||||
if _, err := loadSecretsFromConfig(cfg, logger); err != nil {
|
||||
return nil, fmt.Errorf("load secrets from files: %w", err)
|
||||
}
|
||||
store, err := newObjectStoreFromConfigFn(ctx, cfg)
|
||||
return initializeObjectStoreBackend(ctx, cfg, newObjectStoreFromConfigFn)
|
||||
}
|
||||
|
||||
func initializeObjectStoreBackend(
|
||||
ctx context.Context,
|
||||
cfg *config.Config,
|
||||
factory func(context.Context, *config.Config) (storage.ObjectStore, error),
|
||||
) (storage.ObjectStore, error) {
|
||||
store, err := factory(ctx, cfg)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("initialize object store backend: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user