Skip to content

Commit

Permalink
Merge pull request #6 from mgaare/bugfix_provider_init_failed
Browse files Browse the repository at this point in the history
Don't use a nil provider
  • Loading branch information
alexei-led authored Aug 30, 2020
2 parents 43b90fe + a3fb06c commit cf05481
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,16 @@ func run(ctx context.Context, provider secrets.Provider, commandSlice []string)
// create a dedicated pidgroup used to forward signals to the main process and its children
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}

// set environment variables
var err error
cmd.Env, err = provider.ResolveSecrets(ctx, os.Environ())
if err != nil {
log.WithError(err).Error("failed to resolve secrets")
// set environment variables
if provider != nil {
cmd.Env, err = provider.ResolveSecrets(ctx, os.Environ())
if err != nil {
log.WithError(err).Error("failed to resolve secrets")
}
} else {
log.Warn("no secrets provider available; using environment without resolving secrets")
cmd.Env = os.Environ()
}

// start the specified command
Expand Down

0 comments on commit cf05481

Please sign in to comment.