🔧
This commit is contained in:
10
vendor/laravel/sail/bin/sail
vendored
10
vendor/laravel/sail/bin/sail
vendored
@@ -128,8 +128,9 @@ else
|
||||
fi
|
||||
|
||||
# Source the ".env" file so Laravel's environment variables are available...
|
||||
if [ ! -z "$APP_ENV" ] && [ -f ./.env.$APP_ENV ]; then
|
||||
source ./.env.$APP_ENV;
|
||||
# shellcheck source=/dev/null
|
||||
if [ -n "$APP_ENV" ] && [ -f ./.env."$APP_ENV" ]; then
|
||||
source ./.env."$APP_ENV";
|
||||
elif [ -f ./.env ]; then
|
||||
source ./.env;
|
||||
fi
|
||||
@@ -159,8 +160,7 @@ function sail_is_not_running {
|
||||
}
|
||||
|
||||
# Define Docker Compose command prefix...
|
||||
docker compose &> /dev/null
|
||||
if [ $? == 0 ]; then
|
||||
if docker compose &> /dev/null; then
|
||||
DOCKER_COMPOSE=(docker compose)
|
||||
else
|
||||
DOCKER_COMPOSE=(docker-compose)
|
||||
@@ -560,7 +560,7 @@ elif [ "$1" == "open" ]; then
|
||||
shift 1
|
||||
|
||||
if [ "$EXEC" == "yes" ]; then
|
||||
open $APP_URL
|
||||
open "$APP_URL"
|
||||
|
||||
exit
|
||||
else
|
||||
|
||||
@@ -19,6 +19,7 @@ trait InteractsWithDockerComposeServices
|
||||
'redis',
|
||||
'memcached',
|
||||
'meilisearch',
|
||||
'typesense',
|
||||
'minio',
|
||||
'mailpit',
|
||||
'selenium',
|
||||
@@ -86,7 +87,7 @@ trait InteractsWithDockerComposeServices
|
||||
// Merge volumes...
|
||||
collect($services)
|
||||
->filter(function ($service) {
|
||||
return in_array($service, ['mysql', 'pgsql', 'mariadb', 'redis', 'meilisearch', 'minio']);
|
||||
return in_array($service, ['mysql', 'pgsql', 'mariadb', 'redis', 'meilisearch', 'typesense', 'minio']);
|
||||
})->filter(function ($service) use ($compose) {
|
||||
return ! array_key_exists($service, $compose['volumes'] ?? []);
|
||||
})->each(function ($service) use (&$compose) {
|
||||
@@ -116,14 +117,31 @@ trait InteractsWithDockerComposeServices
|
||||
{
|
||||
$environment = file_get_contents($this->laravel->basePath('.env'));
|
||||
|
||||
if (in_array('pgsql', $services)) {
|
||||
$environment = str_replace('DB_CONNECTION=mysql', "DB_CONNECTION=pgsql", $environment);
|
||||
if (in_array('mysql', $services) ||
|
||||
in_array('mariadb', $services) ||
|
||||
in_array('pgsql', $services)) {
|
||||
$defaults = [
|
||||
'# DB_HOST=127.0.0.1',
|
||||
'# DB_PORT=3306',
|
||||
'# DB_DATABASE=laravel',
|
||||
'# DB_USERNAME=root',
|
||||
'# DB_PASSWORD=',
|
||||
];
|
||||
|
||||
foreach ($defaults as $default) {
|
||||
$environment = str_replace($default, substr($default, 2), $environment);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array('mysql', $services)) {
|
||||
$environment = preg_replace('/DB_CONNECTION=.*/', 'DB_CONNECTION=mysql', $environment);
|
||||
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=mysql", $environment);
|
||||
}elseif (in_array('pgsql', $services)) {
|
||||
$environment = preg_replace('/DB_CONNECTION=.*/', 'DB_CONNECTION=pgsql', $environment);
|
||||
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=pgsql", $environment);
|
||||
$environment = str_replace('DB_PORT=3306', "DB_PORT=5432", $environment);
|
||||
} elseif (in_array('mariadb', $services)) {
|
||||
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=mariadb", $environment);
|
||||
} else {
|
||||
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=mysql", $environment);
|
||||
}
|
||||
|
||||
$environment = str_replace('DB_USERNAME=root', "DB_USERNAME=sail", $environment);
|
||||
@@ -143,6 +161,14 @@ trait InteractsWithDockerComposeServices
|
||||
$environment .= "\nMEILISEARCH_NO_ANALYTICS=false\n";
|
||||
}
|
||||
|
||||
if (in_array('typesense', $services)) {
|
||||
$environment .= "\nSCOUT_DRIVER=typesense";
|
||||
$environment .= "\nTYPESENSE_HOST=typesense";
|
||||
$environment .= "\nTYPESENSE_PORT=8108";
|
||||
$environment .= "\nTYPESENSE_PROTOCOL=http";
|
||||
$environment .= "\nTYPESENSE_API_KEY=xyz\n";
|
||||
}
|
||||
|
||||
if (in_array('soketi', $services)) {
|
||||
$environment = preg_replace("/^BROADCAST_DRIVER=(.*)/m", "BROADCAST_DRIVER=pusher", $environment);
|
||||
$environment = preg_replace("/^PUSHER_APP_ID=(.*)/m", "PUSHER_APP_ID=app-id", $environment);
|
||||
|
||||
16
vendor/laravel/sail/stubs/typesense.stub
vendored
Normal file
16
vendor/laravel/sail/stubs/typesense.stub
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
typesense:
|
||||
image: 'typesense/typesense:0.25.2'
|
||||
ports:
|
||||
- '${FORWARD_TYPESENSE_PORT:-8108}:8108'
|
||||
environment:
|
||||
TYPESENSE_DATA_DIR: '${TYPESENSE_DATA_DIR:-/typesense-data}'
|
||||
TYPESENSE_API_KEY: '${TYPESENSE_API_KEY:-xyz}'
|
||||
TYPESENSE_ENABLE_CORS: '${TYPESENSE_ENABLE_CORS:-true}'
|
||||
volumes:
|
||||
- 'sail-typesense:/typesense-data'
|
||||
networks:
|
||||
- sail
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:8108/health"]
|
||||
retries: 5
|
||||
timeout: 7s
|
||||
Reference in New Issue
Block a user