Skip to content

Commit

Permalink
feat: pass through all env variables from parent process to restic
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed Mar 19, 2024
1 parent 564e99d commit 24afd51
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/orchestrator/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()...))
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 24afd51

Please sign in to comment.