mlodhi
mlodhi

Reputation: 732

Shopware 6: How to set boolean config values with Docker exec in Git Bash

I'm running a Bash script on Windows Git Bash that uses docker exec to set config values in my Shopware container:

docker exec -d $SHOPWARE_CONTAINER_ID php bin/console system:config:set $PLUGIN_NAME.config.active true

But I get an error that the config value must be a boolean, not a string. It seems passing "true" from Bash sets it as a string, when it needs to be a proper bool value. How can I properly set a boolean config value true/false from a Bash script using docker exec?

Upvotes: 2

Views: 87

Answers (2)

mlodhi
mlodhi

Reputation: 732

I solved this issue by using -j (-json) to decode the true as a bool.

docker exec  $SHOPWARE_CONTAINER_ID php bin/console system:config:set -j $PLUGIN_NAME.config.active true

Upvotes: 2

3ximus
3ximus

Reputation: 390

There's seems to be a decode option added on this commit https://github.com/shopware/shopware/pull/2209/commits/e4d49e20248be3e770860297417ef5a87b7fb686#diff-a041d80e81de3a24e5d1b155454509b67b3c5c0d72732b311a00aa47fccefbe1R33

It allows an input value to be interpreted as JSON and therefore be converted to boolean. I believe it can be used like this --decode or -d

Upvotes: 2

Related Questions