Skip to content

Commit

Permalink
Gets the default "tld" on install.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiCO2k committed May 3, 2024
1 parent ad66a9a commit 1897e82
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,25 @@ protected function commitChanges(string $message, string $directory, InputInterf
$this->runCommands($commands, $input, $output, workingPath: $directory);
}

/**
* Gets the "tld" that should be used.
*
* @return string
*/
protected function getTld()
{
foreach (['herd', 'valet'] as $tool) {
$process = new Process([$tool, 'tld']);
$process->run();

if ($process->isSuccessful()) {
return trim($process->getOutput());
}
}

return 'test';
}

/**
* Create a GitHub repository and push the git log to it.
*
Expand Down Expand Up @@ -745,7 +764,7 @@ protected function verifyApplicationDoesntExist($directory)
*/
protected function generateAppUrl($name)
{
$hostname = mb_strtolower($name).'.test';
$hostname = mb_strtolower($name).'.'.$this->getTld();

return $this->canResolveHostname($hostname) ? 'http://'.$hostname : 'http://localhost';
}
Expand Down

0 comments on commit 1897e82

Please sign in to comment.