Skip to content

Commit

Permalink
Allow choosing not to have vanity domains for an environment (#153)
Browse files Browse the repository at this point in the history
* allow choosing now to have vanity domains for an environment

* Update EnvCommand.php

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
themsaid and taylorotwell authored Oct 18, 2021
1 parent 43ae7fe commit 9e97685
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/Commands/EnvCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ protected function configure()
->setName('env')
->addArgument('environment', InputArgument::REQUIRED, 'The environment name')
->addOption('docker', null, InputOption::VALUE_NONE, 'Indicate that the environment will use Docker images as its runtime')
->addOption('no-vanity-domain', null, InputOption::VALUE_NONE, 'Indicate that the environment should not be assigned vanity domains')
->setDescription('Create a new environment');
}

Expand All @@ -37,7 +38,8 @@ public function handle()
$this->vapor->createEnvironment(
Manifest::id(),
$environment = $this->argument('environment'),
$this->option('docker')
$this->option('docker'),
! $this->option('no-vanity-domain')
);

Manifest::addEnvironment($environment, [
Expand Down
3 changes: 2 additions & 1 deletion src/Commands/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public function handle()
$response = $this->vapor->createProject(
$this->determineName(),
$this->determineProvider('Which cloud provider should the project belong to?'),
$this->determineRegion('Which region should the project be placed in?')
$this->determineRegion('Which region should the project be placed in?'),
Helpers::confirm('Would you like Vapor to assign vanity domains to each of your environments?')
);

Manifest::fresh($response['project']);
Expand Down
11 changes: 7 additions & 4 deletions src/ConsoleVaporClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -784,14 +784,16 @@ public function project($projectId)
* @param string $name
* @param int $providerId
* @param string $region
* @param bool $usesVanityDomain
* @return array
*/
public function createProject($name, $providerId, $region)
public function createProject($name, $providerId, $region, $usesVanityDomain)
{
return $this->requestWithErrorHandling('post', '/api/teams/'.Helpers::config('team').'/projects', array_filter([
'cloud_provider_id' => $providerId,
'name' => $name,
'region' => $region,
'name' => $name,
'region' => $region,
'uses_vanity_domain' => $usesVanityDomain,
]));
}

Expand Down Expand Up @@ -853,11 +855,12 @@ public function environment($projectId, $environmentId)
* @param bool $usesContainerImage
* @return array
*/
public function createEnvironment($projectId, $environment, $usesContainerImage = false)
public function createEnvironment($projectId, $environment, $usesContainerImage = false, $usesVanityDomain = true)
{
return $this->requestWithErrorHandling('post', '/api/projects/'.$projectId.'/environments', [
'name' => $environment,
'uses_container_image' => $usesContainerImage,
'uses_vanity_domain' => $usesVanityDomain,
]);
}

Expand Down

0 comments on commit 9e97685

Please sign in to comment.