Skip to content

Commit

Permalink
Adds in the ability for users to directly configure their environment…
Browse files Browse the repository at this point in the history
… settings with AcquiaCli. (#87)
  • Loading branch information
typhonius committed May 20, 2020
1 parent 0ec4213 commit 82d4f48
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/Commands/EnvironmentsCommand.php
Expand Up @@ -231,4 +231,33 @@ public function environmentDelete(Environments $environmentsAdapter, $uuid, $env
$this->waitForNotification($response);
}
}

/**
* Configures an environment.
*
* Allowed values for configuration update are:
* version: The PHP version.
* max_execution_time: The maximum execution time for PHP scripts.
* memory_limit: The PHP memory limit.
* apcu: The APCu memory limit.
* max_input_vars: The maximum number of input variables.
* max_post_size: The maximum POST size.
* sendmail_path: The path and any options required for sendmail.
*
* @param string $uuid
* @param string $environment
* @param string $key
* @param string $value
*
* @command environment:configure
* @aliases env:config,e:c,environment:config
*/
public function environmentConfigure(Environments $environmentsAdapter, $uuid, $environment, $key, $value)
{
$environment = $this->cloudapiService->getEnvironment($uuid, $environment);
if ($this->confirm(sprintf('Are you sure you want to update the %s environment with [%s => %s]?', $environment->label, $key, $value))) {
$this->say(sprintf('Configuring %s with [%s => %s]', $environment->label, $key, $value));
$environmentsAdapter->update($environment->uuid, [$key => $value]);
}
}
}
3 changes: 2 additions & 1 deletion tests/AcquiaCliTestCase.php
Expand Up @@ -218,7 +218,8 @@ public static function getFixtureMap()
'post' => 'Ides/createIde.json'
],
'/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470' => [
'delete' => 'Environments/deleteCDEnvironment.json'
'delete' => 'Environments/deleteCDEnvironment.json',
'put' => 'Environments/updateEnvironment.json'
],
'/environments/32-a47ac10b-58cc-4372-a567-0e02b2c3d470/databases/database1/backups' => [
'get' => 'DatabaseBackups/getAllDatabaseBackups.json',
Expand Down
4 changes: 4 additions & 0 deletions tests/Commands/EnvironmentCommandTest.php
Expand Up @@ -99,6 +99,10 @@ public function environmentProvider()
[
['environment:delete', 'devcloud:devcloud2', 'dev'],
'> Deleting Dev environment' . PHP_EOL
],
[
['environment:configure', 'devcloud:devcloud2', 'dev', 'version', '7.4'],
'> Configuring Dev with [version => 7.4]' . PHP_EOL
]
];
}
Expand Down

0 comments on commit 82d4f48

Please sign in to comment.