Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-ivona committed Dec 15, 2023
1 parent 4308b57 commit fd95c58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/Containers/Commands/MakeDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ public function handle(DockerService $docker_service, TerminalService $terminal)
$dbuser = $this->ask('Database User Name', 'dbuser');
$dbpassword = $this->ask('Database User Password', 'dbpassword');

if (!$this->execute_mysql_command($docker_service, $terminal, "create database $dbname")) {
if (!$this->execute_mysql_command($terminal, "create database $dbname")) {
$this->error('Database creation failed');
return self::FAILURE;
}

if (!$this->execute_mysql_command($docker_service, $terminal, "create user '$dbuser'@'docker' identified by '$dbpassword'")) {
if (!$this->execute_mysql_command($terminal, "create user '$dbuser'@'%' identified by '$dbpassword'")) {
$this->error('User creation failed');
return self::FAILURE;
}

if (!$this->execute_mysql_command($docker_service, $terminal, "GRANT ALL ON $dbname.* TO '$dbuser'@'docker'")) {
if (!$this->execute_mysql_command($terminal, "GRANT ALL ON $dbname.* TO '$dbuser'@'%'")) {
$this->error('User permission setup failed');
return self::FAILURE;
}

return self::SUCCESS;
}

private function execute_mysql_command(DockerService $docker_service, TerminalService $terminal_service, string $command): int
private function execute_mysql_command(TerminalService $terminal_service, string $command): int
{
$password = env('MYSQL_ROOT_PASSWORD');

Expand Down
2 changes: 0 additions & 2 deletions app/Containers/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,6 @@ public function execute(TerminalService $terminal, array $commands, string $inpu

$commands = array_merge($service_command, $commands);

dump($commands);

return $terminal->execute($commands, $input);
}

Expand Down

0 comments on commit fd95c58

Please sign in to comment.