Skip to content
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

Allow environment variables when configuring FPM pools #650

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrisboulton
Copy link
Contributor

Pull Request (PR) description

Allows for PHP FPM pool settings to be configured as environment variables (pm_max_children => '${PM_MAX_CHILDREN}') in addition to their existing typed formats.

I debated about the best way to add this, and ended up adding Variant types, along with a single custom type. I did this because there were varying types (Integer[0], Integer[1], Php::Duration) that I didn't want to have to duplicate.

The env based configuration applies to every setting, but for right now I've added it to the most common ones where due to the stricter validation, it would previously fail.

This Pull Request (PR) fixes the following issues

Fixes #649

Copy link
Member

@smortex smortex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some dumb reflexion since I do not use PHP much…

My feeling is that any parameter which does not accept String should accept a Php::EnvString, right? I see some Stdlib::Absolutepath, Stdlib::Filemode, Integer, Enum['yes', 'no']: should these also be adjusted to allow variables?

@@ -0,0 +1 @@
type Php::EnvString = Pattern[/\$\{[\w]+\}/]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The square brackets look redundant and I think we should anchor the regexp:

Suggested change
type Php::EnvString = Pattern[/\$\{[\w]+\}/]
type Php::EnvString = Pattern[/\A\$\{\w+\}\z/]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data type validation in fpm::pool breaks ability to use environment variables as values
2 participants