From 38c7f074ce03e9730c413e3d3268c9d1c5a3903a Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen.haas@lakedrops.com>
Date: Mon, 25 Jul 2022 11:40:49 +0200
Subject: [PATCH] drupal/development/eca#1 Disable Redis settings for "drush
 si" and install Redis automatically afterwards

---
 bin/drush | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/bin/drush b/bin/drush
index dda1b33..20f0741 100755
--- a/bin/drush
+++ b/bin/drush
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 function setPermissions {
-  chmod -R g+w .
+  sudo chmod -R g+w .
 }
 
 FLAG=
@@ -9,13 +9,18 @@ if [[ "$1" == "-T" ]]; then
   FLAG=-T
   shift
 fi
+if [[ "$1" == "si" ]] || [[ "$1" == "sin" ]] || [[ "$1" == "site-install" ]]; then
+  FLAG="$FLAG -e L3D_DISABLE_REDIS=yes"
+fi
 docker compose exec $FLAG ${LAKEDROPS_DEV_DC_OPTIONS} php drush "$@"
 EC=$?
 
-if [[ "$1" == "gen" ]]; then
-  setPermissions
+if [[ "$1" == "si" ]] || [[ "$1" == "sin" ]] || [[ "$1" == "site-install" ]]; then
+  if [[ -f web/modules/contrib/redis/example.services.yml ]]; then
+    docker compose exec $FLAG ${LAKEDROPS_DEV_DC_OPTIONS} php drush -y en redis
+  fi
 fi
-if [[ "$1" == "generate" ]]; then
+if [[ "$1" == "gen" ]] || [[ "$1" == "generate" ]]; then
   setPermissions
 fi
 
-- 
GitLab