Skip to content

Commit

Permalink
Merge pull request #192 from stellarwp/1.6.2
Browse files Browse the repository at this point in the history
1.6.2
  • Loading branch information
lucatume committed May 10, 2024
2 parents 308dfb6 + 004303f commit ad0c18d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
1 change: 1 addition & 0 deletions slic-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
20 changes: 15 additions & 5 deletions src/slic.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -720,12 +728,14 @@ function slic_info() {
];

echo colorize( "<yellow>Configuration read from the following files:</yellow>" . 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( "<yellow>Current configuration:</yellow>" . PHP_EOL );
foreach ( $config_vars as $key ) {
Expand Down

0 comments on commit ad0c18d

Please sign in to comment.