Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Commit

Permalink
support custom windows path
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed Oct 4, 2019
1 parent 9436dbe commit 06ba896
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions daemon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,32 @@ func FromEnviron() (Config, error) {
config.Client.Proto,
config.Client.Host,
)
if config.Runner.EnvFile != "" {
envs, err := godotenv.Read(config.Runner.EnvFile)

// environment variables can be sourced from a separate
// file. These variables are loaded and appended to the
// environment list.
if file := config.Runner.EnvFile; file != "" {
envs, err := godotenv.Read(file)
if err != nil {
return config, err
}
for k, v := range envs {
config.Runner.Environ[k] = v
}
}

// setting a custom path is a common configuration
// requirement. We therefore provide a configuration
// parameter specifically for PATH and then append
// to the environment variable list.
if path := config.Runner.Path; path != "" {
config.Runner.Environ["PATH"] = path
switch config.Platform.OS {
case "windows":
config.Runner.Environ["Path"] = path
default:
config.Runner.Environ["PATH"] = path
}
}

return config, nil
}

0 comments on commit 06ba896

Please sign in to comment.