Isolate runner object store construction

This commit is contained in:
2026-09-04 13:01:00 +00:00
parent 2e69c14898
commit 6a15052d77
4 changed files with 35 additions and 17 deletions

View File

@@ -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)
}