MCPcopy Index your code
hub / github.com/coder/coder / envValInt

Function envValInt

agent/agentexec/exec.go:122–133  ·  view source on GitHub ↗

envValInt searches for a key in a list of environment variables and parses it to an int. If the key is not found or cannot be parsed, returns 0 and false.

(key string)

Source from the content-addressed store, hash-verified

120// envValInt searches for a key in a list of environment variables and parses it to an int.
121// If the key is not found or cannot be parsed, returns 0 and false.
122func envValInt(key string) (int, bool) {
123 val, ok := os.LookupEnv(key)
124 if !ok {
125 return 0, false
126 }
127
128 i, err := strconv.Atoi(val)
129 if err != nil {
130 return 0, false
131 }
132 return i, true
133}
134
135// The following are flags used by the agent-exec command. We use flags instead of
136// environment variables to avoid having to deal with a caller overriding the

Callers 1

NewExecerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected