Skip to content
Snippets Groups Projects
Commit 7878b86d authored by Carlos Busto Capeáns's avatar Carlos Busto Capeáns Committed by Jürgen Haas
Browse files

Issue #3459899: Display the url to finish agent configuration using drush

parent c7c11e06
No related branches found
No related tags found
1 merge request!10Issue #3459899: Add Drush 11+ compatibility
Pipeline #289852 failed
......@@ -2,6 +2,7 @@
namespace Drupal\drd_agent\Drush\Commands;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\drd_agent\Setup;
use Drush\Attributes as CLI;
use Drush\Commands\DrushCommands as RootDrushCommands;
......@@ -13,6 +14,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* @package Drupal\drd_agent
*/
class DrushCommands extends RootDrushCommands {
use StringTranslationTrait;
/**
* The setup service.
......@@ -58,8 +60,14 @@ class DrushCommands extends RootDrushCommands {
#[CLI\Usage(name: 'drd:agent:setup', description: 'Configure this domain for communication with a DRD instance.')]
public function setup(string $token): void {
$_SESSION['drd_agent_authorization_values'] = $token;
$this->setupService->execute();
$values = $this->setupService->execute();
unset($_SESSION['drd_agent_authorization_values']);
if (isset($values['redirect']) && !empty($values['redirect'])) {
$this->logger()?->success($this->t("To finish configuring the agent, you must access (authenticated) the following URL of the DRD portal where it is being added: \n @url", ['@url' => $values['redirect']]));
}
else {
$this->logger()?->error($this->t("There was an error configuring the DRD agent."));
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment