-
Notifications
You must be signed in to change notification settings - Fork 185
PHP-FPM options via environment variables #394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from public dir |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,3 +194,18 @@ func IsPresentAndTrue(varName string) (bool, error) { | |
|
|
||
| return parsed, nil | ||
| } | ||
|
|
||
| // IsPresentAndInt returns true and the integer value if the environment variable evaluates exists and contains an integer. | ||
| func IsPresentAndInt(varName string) (bool, int, error) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: not a big deal, but I would simplify this to return 2 values instead of 3: We lost the error indication, but simplify things a bit. Your call.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be honest, I initially wrote it this way then backtracked, as everywhere else is very heavy on catching the errors & throwing them properly, so I didn't want to implement something that would silently fail (and revert to the default) if someone makes a mistake in the environment variable and it doesn't parse properly. I'm happy either way though - if someone from Google can weigh in on which one you'd be more likely to accept for merge, I'll make it so. |
||
| varValue, present := os.LookupEnv(varName) | ||
| if !present { | ||
| return false, 0, nil | ||
| } | ||
|
|
||
| parsed, err := strconv.Atoi(varValue) | ||
| if err != nil { | ||
| return false, 0, fmt.Errorf("parsing %s: %v", varName, err) | ||
| } | ||
|
|
||
| return true, parsed, nil | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.