diff --git a/src/Commands/EnvCommand.php b/src/Commands/EnvCommand.php index ba6fc062..0bd54b9b 100644 --- a/src/Commands/EnvCommand.php +++ b/src/Commands/EnvCommand.php @@ -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'); } @@ -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, [ diff --git a/src/Commands/InitCommand.php b/src/Commands/InitCommand.php index fa955178..9fc5691c 100644 --- a/src/Commands/InitCommand.php +++ b/src/Commands/InitCommand.php @@ -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']); diff --git a/src/ConsoleVaporClient.php b/src/ConsoleVaporClient.php index 3b027dbf..7316c77a 100644 --- a/src/ConsoleVaporClient.php +++ b/src/ConsoleVaporClient.php @@ -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, ])); } @@ -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, ]); }