|
37 | 37 | ErrSignalFailed = errRun.Code("signal_failed").ErrorPref("error while propagating signal to process: %s") |
38 | 38 | ErrReadEnvDir = errRun.Code("env_dir_read_error").ErrorPref("could not read the environment directory: %s") |
39 | 39 | ErrReadEnvFile = errRun.Code("env_file_read_error").ErrorPref("could not read the environment file %s: %s") |
| 40 | + ErrReadDefaultEnvFile = errRun.Code("default_env_file_read_error").ErrorPref("could not read default run env-file %s: %s") |
40 | 41 | ErrEnvDirNotFound = errRun.Code("env_dir_not_found").Error(fmt.Sprintf("could not find specified environment. Make sure you have executed `%s set`.", ApplicationName)) |
41 | 42 | ErrTemplate = errRun.Code("invalid_template").ErrorPref("could not parse template at line %d: %s") |
42 | 43 | ErrParsingTemplate = errRun.Code("template_parsing_failed").ErrorPref("error while processing template file '%s': %s") |
|
45 | 46 | ) |
46 | 47 |
|
47 | 48 | const ( |
48 | | - maskString = "<redacted by SecretHub>" |
| 49 | + defaultEnvFile = "secrethub.env" |
| 50 | + maskString = "<redacted by SecretHub>" |
49 | 51 | // templateVarEnvVarPrefix is used to prefix environment variables |
50 | 52 | // that should be used as template variables. |
51 | 53 | templateVarEnvVarPrefix = "SECRETHUB_VAR_" |
@@ -224,12 +226,11 @@ func (cmd *RunCommand) sourceEnvironment() ([]string, []string, error) { |
224 | 226 | envSources = append(envSources, flagSource) |
225 | 227 |
|
226 | 228 | if cmd.envFile == "" { |
227 | | - const defaultEnvFile = "secrethub.env" |
228 | 229 | _, err := cmd.osStat(defaultEnvFile) |
229 | 230 | if err == nil { |
230 | 231 | cmd.envFile = defaultEnvFile |
231 | 232 | } else if !os.IsNotExist(err) { |
232 | | - return nil, nil, fmt.Errorf("could not read default run env-file %s: %s", defaultEnvFile, err) |
| 233 | + return nil, nil, ErrReadDefaultEnvFile(defaultEnvFile, err) |
233 | 234 | } |
234 | 235 | } |
235 | 236 |
|
|
0 commit comments