View Code? Open in Web Editor
NEW
Configures .env file to match the laravel sail environment variable's requirements.
Home Page: https://packagist.org/packages/jedymatt/laravel-sail-env
License: MIT License
laravel-sail-env's Introduction
laravel-sail-env's People
Contributors
Watchers
laravel-sail-env's Issues
Detected duplicate mysql services
Console Output
Detected services from docker-compose.yml: [mysql,mysql]
Successfully configured .env file.
docker-compose.yml
phpmyadmin:
image: phpmyadmin
links:
- mysql:mysql
ports:
- 8080:80
environment:
MYSQL_USERNAME: "${DB_USERNAME}"
MYSQL_ROOT_PASSWORD: "${DB_PASSWORD}"
PMA_HOST: mysql
networks:
- sail
The - mysql:
is detected as the second MySQL service
The code to improve
|
$regex = '/'.implode('|', array_map(function ($service) { |
|
return '(?<=\s)'.$service.'(?=:)'; // Match service name followed by ':' (e.g. mysql:) and preceded by whitespace |
|
}, $this->services)).'/'; |
It replaces .env from .env.example before replacing env variables
Do not inherit InstallCommand. Instantiate it instead like (new InstallCommand())->replaceEnvVariables($services)
.