protected function configure() { parent::configure(); $this->setName('environment:http-access')->setAliases(array('httpaccess'))->setDescription('Update HTTP access settings for an environment')->addOption('access', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Access restriction in the format "permission:address"')->addOption('auth', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Authentication details in the format "username:password"')->addOption('enabled', null, InputOption::VALUE_OPTIONAL, 'Whether access control should be enabled: 1 to enable, 0 to disable'); $this->addProjectOption()->addEnvironmentOption(); $this->addExample('Require a username and password', '--auth myname:mypassword'); $this->addExample('Restrict access to only one IP address', '--access deny:any --access allow:69.208.1.192'); $this->addExample('Remove the password requirement, keeping IP restrictions', '--auth 0'); $this->addExample('Disable all HTTP access control', '--enabled 0'); }
/** * Get a list of environment IDs. * * The project is either defined by an ID that the user has specified in * the command (via the 'id' argument of 'get', or the '--project' option), * or it is determined from the current path. * * @return string[] */ public function getEnvironments() { if (!$this->projects) { return array(); } $commandLine = $this->handler->getContext()->getCommandLine(); $currentProjectId = $this->getProjectIdFromCommandLine($commandLine); if (!$currentProjectId && ($currentProject = $this->platformCommand->getCurrentProject())) { $project = $currentProject; } elseif (isset($this->projects[$currentProjectId])) { $project = $this->projects[$currentProjectId]; } else { return array(); } $environments = $this->platformCommand->getEnvironments($project, false, false); return array_keys($environments); }
protected function validateInput(InputInterface $input, OutputInterface $output, $envNotRequired = null) { if (!parent::validateInput($input, $output)) { return false; } $this->domainName = $input->getArgument('name'); if (empty($this->domainName)) { $output->writeln("<error>You must specify the name of the domain.</error>"); return false; } else { if (!$this->validDomain($this->domainName)) { $output->writeln("<error>You must specify a valid domain name.</error>"); return false; } } $this->certPath = $input->getOption('cert'); $this->keyPath = $input->getOption('key'); $this->chainPaths = $input->getOption('chain'); if ($this->certPath || $this->keyPath || $this->chainPaths) { return $this->validateSslOptions(); } return true; }
protected function configure() { parent::configure(); $this->setName('environment:http-access')->setAliases(array('httpaccess'))->setDescription('Update HTTP access settings for an environment')->addOption('access', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Access restriction in the format "permission:address"')->addOption('auth', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Authentication details in the format "username:password"'); $this->addProjectOption()->addEnvironmentOption(); }