1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-06 00:40:06 +01:00

Change valet domain command to valet tld

Fixes #144
".test" or ".dev" is really a TLD, not a "domain" in the conventional sense.
Changing the command to `valet tld` more accurately reflects the purpose of the command (to set or get the configured TLD served by Valet)

The use of `valet domain` is currently preserved as an alias for `valet tld`, but will be removed at a later date.
This commit is contained in:
Chris Brown
2017-10-17 15:47:39 -04:00
parent 9394811a09
commit 58e4645fe2
6 changed files with 41 additions and 39 deletions

View File

@@ -40,7 +40,7 @@
Configuration::install();
Nginx::install();
PhpFpm::install();
DnsMasq::install(Configuration::read()['domain']);
DnsMasq::install(Configuration::read()['tld']);
Nginx::restart();
Valet::symlinkToUsersBin();
@@ -52,25 +52,25 @@
*/
if (is_dir(VALET_HOME_PATH)) {
/**
* Get or set the domain currently being used by Valet.
* Get or set the TLD currently being used by Valet.
*/
$app->command('domain [domain]', function ($domain = null) {
if ($domain === null) {
return info(Configuration::read()['domain']);
$app->command('tld [tld]', function ($tld = null) {
if ($tld === null) {
return info('Valet is configured to serve for TLD: .'.Configuration::read()['tld']);
}
DnsMasq::updateDomain(
$oldDomain = Configuration::read()['domain'], $domain = trim($domain, '.')
DnsMasq::updateTld(
$oldTld = Configuration::read()['tld'], $tld = trim($tld, '.')
);
Configuration::updateKey('domain', $domain);
Configuration::updateKey('tld', $tld);
Site::resecureForNewDomain($oldDomain, $domain);
Site::resecureForNewTld($oldTld, $tld);
PhpFpm::restart();
Nginx::restart();
info('Your Valet domain has been updated to ['.$domain.'].');
})->descriptions('Get or set the domain used for Valet sites');
info('Your Valet TLD has been updated to ['.$tld.'].');
}, ['domain'])->descriptions('Get or set the TLD used for Valet sites. (Currently: .'.Configuration::read()['tld'].')');
/**
* Add the current working directory to the paths configuration.
@@ -125,7 +125,7 @@
* Secure the given domain with a trusted TLS certificate.
*/
$app->command('secure [domain]', function ($domain = null) {
$url = ($domain ?: Site::host(getcwd())).'.'.Configuration::read()['domain'];
$url = ($domain ?: Site::host(getcwd())).'.'.Configuration::read()['tld'];
Site::secure($url);
@@ -140,7 +140,7 @@
* Stop serving the given domain over HTTPS and remove the trusted TLS certificate.
*/
$app->command('unsecure [domain]', function ($domain = null) {
$url = ($domain ?: Site::host(getcwd())).'.'.Configuration::read()['domain'];
$url = ($domain ?: Site::host(getcwd())).'.'.Configuration::read()['tld'];
Site::unsecure($url);
@@ -183,7 +183,7 @@
* Open the current or given directory in the browser.
*/
$app->command('open [domain]', function ($domain = null) {
$url = "http://".($domain ?: Site::host(getcwd())).'.'.Configuration::read()['domain'];
$url = "http://".($domain ?: Site::host(getcwd())).'.'.Configuration::read()['tld'];
CommandLine::runAsUser("open ".escapeshellarg($url));
})->descriptions('Open the site for the current (or specified) directory in your browser');