Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.6.2 #192

Merged
merged 6 commits into from
May 10, 2024
Merged

1.6.2 #192

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading