From f531edb4406b399ced869f94dcfcb4892e284dc5 Mon Sep 17 00:00:00 2001 From: sirir Date: Tue, 25 Mar 2025 21:39:12 +0100 Subject: [PATCH] fix local kopia strategy --- internal/backup/strategy/factory.go | 11 +---------- internal/backup/strategy/kopia/local.go | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/internal/backup/strategy/factory.go b/internal/backup/strategy/factory.go index 081f2ed..870d762 100644 --- a/internal/backup/strategy/factory.go +++ b/internal/backup/strategy/factory.go @@ -60,7 +60,7 @@ func (f *Factory) createKopiaStrategy(serviceConfig *models.BackupConfig, source func (f *Factory) createKopiaProvider(strategyConfig models.StrategyConfig) (kopia.Provider, error) { switch strategyConfig.Provider { case "local": - return kopia.NewLocalProvider(getDefaultPath(strategyConfig.Destination.Path)), nil + return kopia.NewLocalProvider(strategyConfig.Destination.Path), nil case "b2", "backblaze": return kopia.NewB2Provider(), nil case "sftp": @@ -74,15 +74,6 @@ func (f *Factory) createKopiaProvider(strategyConfig models.StrategyConfig) (kop } } -// getDefaultPath returns the given path or a default -func getDefaultPath(path string) string { - if path != "" { - return path - } - home, _ := os.UserHomeDir() - return filepath.Join(home, ".backea", "repos") -} - // getServicePath returns a service's path func (f *Factory) getServicePath(groupName string) (string, error) { if serviceGroup, exists := f.Config.Services[groupName]; exists { diff --git a/internal/backup/strategy/kopia/local.go b/internal/backup/strategy/kopia/local.go index 98ff168..1a070ab 100644 --- a/internal/backup/strategy/kopia/local.go +++ b/internal/backup/strategy/kopia/local.go @@ -30,7 +30,6 @@ func (p *LocalProvider) Connect(ctx context.Context, serviceName string, passwor repoPath := filepath.Join(p.BasePath, serviceName) log.Printf("Connecting to local repository at %s with config: %s", repoPath, configPath) - // Ensure the directory exists if err := os.MkdirAll(repoPath, 0755); err != nil { return fmt.Errorf("failed to create repository directory: %w", err) }