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

fix docker image: transform environment variable values to boolean when possible #1239

Merged
merged 1 commit into from
Jun 15, 2021

Conversation

mathieu-pousse
Copy link
Contributor

@mathieu-pousse mathieu-pousse commented Jun 14, 2021

Hello,

Here is a fix for the docker image and its environment variables handling.

As the variables are strings, the checks in the optimizer fail when they are comparing 'true' with true.

The fix transform the string to a boolean value when possible.

This fixes the following command:

docker run -p 3000:3000 -e AMP_OPTIMIZER_MARKDOWN=false -e AMP_OPTIMIZER_SEPARATE_KEYFRAMES=false ampproject/toolbox-optimizer

Let me know

@CLAassistant
Copy link

CLAassistant commented Jun 14, 2021

CLA assistant check
All committers have signed the CLA.

@mathieu-pousse mathieu-pousse changed the title fix: transform environment variable values to boolean when possible fix docker image: transform environment variable values to boolean when possible Jun 14, 2021
Copy link
Member

@samouri samouri left a comment

Choose a reason for hiding this comment

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

This looks great. Thank you for the fix!

@@ -4,6 +4,10 @@ function objectFromEntries(arr) {
return Object.assign({}, ...Array.from(arr, ([k, v]) => ({[k]: v})));
}

function toBooleanIfPossible(value) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: I'd prefer the fn name maybeParseBool.

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

Successfully merging this pull request may close these issues.

None yet

4 participants