From aea7b068daf8db77ac059c201a511dc8cd77ad2b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 30 Dec 2014 14:43:19 +0100 Subject: [PATCH] setup: Add --config switch to TokenCommand::showAction() refs #7906 --- .../application/clicommands/TokenCommand.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/setup/application/clicommands/TokenCommand.php b/modules/setup/application/clicommands/TokenCommand.php index ff0229cfe..0d665cec6 100644 --- a/modules/setup/application/clicommands/TokenCommand.php +++ b/modules/setup/application/clicommands/TokenCommand.php @@ -22,11 +22,22 @@ class TokenCommand extends Command * * USAGE: * - * icingacli setup token show + * icingacli setup token show [options] + * + * OPTIONS: + * + * --config= Path to Icinga Web 2's configuration files [/etc/icingaweb2] */ public function showAction() { - $token = file_get_contents($this->app->getConfigDir() . '/setup.token'); + $configDir = $this->params->get('config', $this->app->getConfigDir()); + if (! is_string($configDir) || strlen(trim($configDir)) === 0) { + $this->fail($this->translate( + 'The argument --config expects a path to Icinga Web 2\'s configuration files' + )); + } + + $token = file_get_contents($configDir . '/setup.token'); if (! $token) { $this->fail( $this->translate('Nothing to show. Please create a new setup token using the generateToken action.')