Skip to content

Commit

Permalink
fix composer not seeing shared db
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-ivona committed Mar 13, 2024
1 parent fc700bd commit 4bd4f4b
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions app/Recipes/Laravel/LaravelRecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function customize_init(Command $parent_command, string $env_content): st
if ($application_env === 'production') {
$enable_opcache = $parent_command->confirm("Should OpCache be enabled?");
$this->set_env($env_content, 'OPCACHE_ENABLED', $enable_opcache ? 1 : 0);
}else{
} else {
$this->set_env($env_content, 'OPCACHE_ENABLED', 0);
}

Expand Down Expand Up @@ -236,6 +236,18 @@ public function build_pulse(): void
}
}

public function build_composer(): void
{
$composer = $this->add_container(Composer::class)
->add_network($this->internal_network());

if ($shared_db_network = env('MYSQL_SHARED_DB_NETWORK')) {
$composer->add_network($shared_db_network);
} else {
$composer->depends_on('mysql');
}
}

protected function recipe_commands(): array
{
$commands = [
Expand Down Expand Up @@ -292,9 +304,7 @@ public function build(): void

$this->build_worker();


$this->add_container(Composer::class)
->add_network($this->internal_network());
$this->build_composer();

$this->add_container(Node::class)
->add_network($this->internal_network())
Expand Down Expand Up @@ -324,7 +334,7 @@ private function build_php(): Php

if ($shared_db_network = env('MYSQL_SHARED_DB_NETWORK')) {
$php->add_network($shared_db_network);
}else{
} else {
$php->depends_on('mysql');
}

Expand Down Expand Up @@ -452,7 +462,7 @@ public function build_websocket(): ?Websocket

if ($shared_db_network = env('MYSQL_SHARED_DB_NETWORK')) {
$websocket->add_network($shared_db_network);
}else{
} else {
$websocket->depends_on('mysql');
}

Expand Down

0 comments on commit 4bd4f4b

Please sign in to comment.