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` diff --git a/slic-stack.yml b/slic-stack.yml index a39810a..edeb249 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} diff --git a/src/slic.php b/src/slic.php index 0fd5a1e..1363f36 100644 --- a/src/slic.php +++ b/src/slic.php @@ -267,6 +267,14 @@ function setup_slic_env( $root_dir, $reset = false ) { 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. @@ -720,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 ) {