Skip to content

Commit

Permalink
Fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov committed Nov 25, 2024
1 parent f2b16b0 commit 6f1ce5a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions internal/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const (
)

const (
defaultIdleTimeoutValue = 15 // seconds
defaultIdleTimeoutValue = "15" // seconds
)

// AllowedOnly filters the current environment down to only those
Expand Down Expand Up @@ -137,10 +137,10 @@ func FromEnv() (*Config, error) {
errs = append(errs, fmt.Errorf("%s is required to be 'true'", EnvVarRunnerServerEnabled))
}

idleTimeoutInt := defaultIdleTimeoutValue
if idleTimeout != "" {
var err error
idleTimeoutInt, err = strconv.Atoi(idleTimeout)
if idleTimeout == "" {
os.Setenv(EnvVarIdleTimeout, defaultIdleTimeoutValue)
} else {
idleTimeoutInt, err := strconv.Atoi(idleTimeout)
if err != nil || idleTimeoutInt < 0 {
errs = append(errs, fmt.Errorf("%s must be a non-negative integer", EnvVarIdleTimeout))
}
Expand All @@ -156,6 +156,5 @@ func FromEnv() (*Config, error) {
MainRunnerServerURI: mainRunnerServerURI,
RunnerServerURI: runnerServerURI,
RunnerServerEnabled: true,
IdleTimeout: idleTimeoutInt,
}, nil
}

0 comments on commit 6f1ce5a

Please sign in to comment.