From a388b89b7e1beaf02e0c2f38a072e17c66410544 Mon Sep 17 00:00:00 2001 From: Yudhistira Mauris Date: Mon, 20 Nov 2023 10:35:09 +0800 Subject: [PATCH 1/4] Add shm_size param to chrome container --- slic-stack.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/slic-stack.yml b/slic-stack.yml index 7332761..6f14000 100644 --- a/slic-stack.yml +++ b/slic-stack.yml @@ -131,6 +131,7 @@ services: interval: 1s timeout: 3s retries: 30 + shm_size: "${SLIC_CHROME_CONTAINER_SHM_SIZE:-256m}" slic: image: ghcr.io/stellarwp/slic-php${SLIC_PHP_VERSION}:${SLIC_VERSION} From 72c752559945d083e8988f3667c2bd2bb1168844 Mon Sep 17 00:00:00 2001 From: Clifford Date: Fri, 26 Apr 2024 16:44:56 -0500 Subject: [PATCH 2/4] Support `.env.slic.local` in target directory --- src/slic.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/slic.php b/src/slic.php index 0fd5a1e..cc6413b 100644 --- a/src/slic.php +++ b/src/slic.php @@ -262,6 +262,15 @@ function setup_slic_env( $root_dir, $reset = false ) { load_env_file( $root_dir . '/.env.slic.local' ); } + $target = slic_target(); // Not working because this is empty - but this is the concept... + + if( ! empty( $target ) ) { + // Load the local overrides from the target. + if ( file_exists( $target . '/.env.slic.local' ) ) { + load_env_file( $target . '/.env.slic.local' ); + } + } + // Load the current session configuration file. if ( file_exists( $root_dir . '/.env.slic.run' ) ) { load_env_file( $root_dir . '/.env.slic.run' ); From b002349947bdd907639633e423c023aa05e94464 Mon Sep 17 00:00:00 2001 From: Clifford Date: Sat, 27 Apr 2024 11:16:21 -0500 Subject: [PATCH 3/4] now it's working --- src/slic.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/slic.php b/src/slic.php index cc6413b..1363f36 100644 --- a/src/slic.php +++ b/src/slic.php @@ -262,20 +262,19 @@ function setup_slic_env( $root_dir, $reset = false ) { load_env_file( $root_dir . '/.env.slic.local' ); } - $target = slic_target(); // Not working because this is empty - but this is the concept... - - if( ! empty( $target ) ) { - // Load the local overrides from the target. - if ( file_exists( $target . '/.env.slic.local' ) ) { - load_env_file( $target . '/.env.slic.local' ); - } - } - // Load the current session configuration file. if ( file_exists( $root_dir . '/.env.slic.run' ) ) { load_env_file( $root_dir . '/.env.slic.run' ); } + $target_path = get_project_local_path(); + if( ! empty( $target_path ) ) { + // Load the local overrides from the target. + if ( file_exists( $target_path . '/.env.slic.local' ) ) { + load_env_file( $target_path . '/.env.slic.local' ); + } + } + /* * Set the host env var to make xdebug work on Linux with host.docker.internal. * This will already be set on Mac/Windows, and overriding it would break things. @@ -729,12 +728,14 @@ function slic_info() { ]; echo colorize( "Configuration read from the following files:" . PHP_EOL ); - $slic_root = root(); + $slic_root = root(); + $target_path = get_project_local_path(); echo implode( PHP_EOL, array_filter( [ - file_exists( $slic_root . '/.env.slic' ) ? " - " . $slic_root . '/.env.slic' : null, - file_exists( $slic_root . '/.env.slic.local' ) ? " - " . $slic_root . '/.env.slic.local' : null, - file_exists( $slic_root . '/.env.slic.run' ) ? " - " . $slic_root . '/.env.slic.run' : null, - ] ) ) . PHP_EOL . PHP_EOL; + file_exists( $slic_root . '/.env.slic' ) ? " - " . $slic_root . '/.env.slic' : null, + file_exists( $slic_root . '/.env.slic.local' ) ? " - " . $slic_root . '/.env.slic.local' : null, + file_exists( $target_path . '/.env.slic.local' ) ? " - " . $target_path . '/.env.slic.local' : null, + file_exists( $slic_root . '/.env.slic.run' ) ? " - " . $slic_root . '/.env.slic.run' : null, + ] ) ) . PHP_EOL . PHP_EOL; echo colorize( "Current configuration:" . PHP_EOL ); foreach ( $config_vars as $key ) { From c2152e4bdf38036baad292d3a21574e9b650054b Mon Sep 17 00:00:00 2001 From: Clifford Date: Sat, 27 Apr 2024 11:22:13 -0500 Subject: [PATCH 4/4] more detailed `.env.slic.local` in readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 39d0fea..596fe2e 100644 --- a/README.md +++ b/README.md @@ -265,8 +265,9 @@ jobs: The `slic` CLI command leverages `.env.*` files to dictate its inner workings. It loads `.env.*` files in the following order, the later files overriding the earlier ones: 1. [`.env.slic`](/.env.slic) - this is the default `.env` file and **should not be edited**. -2. `.env.slic.local` - this file doesn't exist by default, but if you wish to make overrides to the default, create it and add lines to your heart's content. -3. `.env.slic.run` - this file is generated by `slic` and includes settings that are set by specific `slic` commands. +2. `.env.slic.local` in the main _slic_ directory - this file doesn't exist by default. Make overrides to all your projects (e.g. `SLIC_GIT_HANDLE`) by creating it and adding lines to your heart's content. +3. `.env.slic.local` in your _target's_ directory - this file doesn't exist by default. Make overrides to a single project (e.g. `SLIC_PHP_VERSION`). +4. `.env.slic.run` - this file is generated by `slic` and includes settings that are set by specific `slic` commands. ### Xdebug and `slic`