diff --git a/apps/files_external/lib/Command/Config.php b/apps/files_external/lib/Command/Config.php index 0247beaba5f4b..79bb7fdd66347 100644 --- a/apps/files_external/lib/Command/Config.php +++ b/apps/files_external/lib/Command/Config.php @@ -14,6 +14,7 @@ use OCP\AppFramework\Http; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Config extends Base { @@ -40,6 +41,11 @@ protected function configure(): void { 'value', InputArgument::OPTIONAL, 'value to set the config option to, when no value is provided the existing value will be printed' + )->addOption( + 'value-from-file', + null, + InputOption::VALUE_NONE, + 'read the value from the file provided' ); parent::configure(); } @@ -57,6 +63,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int $value = $input->getArgument('value'); if ($value !== null) { + if ($input->getOption('value-from-file')) { + $file = $value; + $value = file_get_contents($file); + if ($value === false) { + $output->writeln('Failed to load value from ' . $file . ''); + return 1; + } + } $this->setOption($mount, $key, $value, $output); } else { $this->getOption($mount, $key, $output);