From 24afd514ad80f542e6e1862d1c42195c6fbe1b47 Mon Sep 17 00:00:00 2001 From: garethgeorge Date: Mon, 18 Mar 2024 23:30:34 -0700 Subject: [PATCH] feat: pass through all env variables from parent process to restic --- internal/orchestrator/repo.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/orchestrator/repo.go b/internal/orchestrator/repo.go index fd4e8693..4a576751 100644 --- a/internal/orchestrator/repo.go +++ b/internal/orchestrator/repo.go @@ -26,10 +26,11 @@ type RepoOrchestrator struct { initialized bool } -// newRepoOrchestrator accepts a config and a repo that is configured with the properties of that config object. -func newRepoOrchestrator(repoConfig *v1.Repo, resticPath string) (*RepoOrchestrator, error) { +// NewRepoOrchestrator accepts a config and a repo that is configured with the properties of that config object. +func NewRepoOrchestrator(repoConfig *v1.Repo, resticPath string) (*RepoOrchestrator, error) { var opts []restic.GenericOption - opts = append(opts, restic.WithPropagatedEnvVars(restic.EnvToPropagate...)) + opts = append(opts, restic.WithEnviron()) + if len(repoConfig.GetEnv()) > 0 { opts = append(opts, restic.WithEnv(repoConfig.GetEnv()...)) } @@ -83,7 +84,7 @@ func (r *RepoOrchestrator) Backup(ctx context.Context, plan *v1.Plan, progressCa r.mu.Lock() defer r.mu.Unlock() if !r.initialized { - if err := r.repo.Init(ctx, restic.WithPropagatedEnvVars(restic.EnvToPropagate...)); err != nil { + if err := r.repo.Init(ctx, restic.WithEnviron()); err != nil { return nil, fmt.Errorf("failed to initialize repo: %w", err) } r.initialized = true