Skip to content

Enable Flag from ENV Var #11

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

Closed
wants to merge 1 commit into from
Closed

Conversation

nhalstead
Copy link

This update allows for control of it's enable state.
I think this should be something included out of the box, I know its a simple change but its something that I think it's helpful as lots of things are controlled via ENV vars in the end.

I have it reading the ENV Value and checking if its string(true), if so then true otherwise false.
If no value is passed in then it defaults to true anyway so its the same result as if this was not added in.

This update allows for control of if you want to enable the Server Timing Header Response.
I think this should be something included out of the box, I know its a simple change but its something that I think I helpful as lots of things are controlled via ENV vars in the end.

I have it reading the ENV Value and checking if its string(true), if so then true otherwise false.
If no value is passed in then it defaults to true anyway so its the same result as if this was not added in.
@nhalstead
Copy link
Author

I also had thought of using filter_var but I think it's a bit overboard for validation of value but allows for "1", "yes", "true", "on", all of the 'non-standard' enable keywords for env var values.

filter_var(env('ENABLE_SERVER_TIMING', 'true'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ?? true,

@nhalstead nhalstead changed the title Update config.php Enable Flag from ENV Var Jun 19, 2020
@mechelon mechelon closed this Mar 18, 2024
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.

2 participants