From 29adfe4dff1147465a17f3937708163d24fef175 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 26 May 2026 20:41:18 +0200 Subject: [PATCH] feat: allow loading external storage config values from file Signed-off-by: Robin Appelman --- apps/files_external/lib/Command/Config.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/files_external/lib/Command/Config.php b/apps/files_external/lib/Command/Config.php index 62016d66c31a1..c275c82b99e43 100644 --- a/apps/files_external/lib/Command/Config.php +++ b/apps/files_external/lib/Command/Config.php @@ -15,6 +15,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,7 +41,12 @@ protected function configure(): void { )->addArgument( 'value', InputArgument::OPTIONAL, - 'value to set the config option to, when no value is provided the existing value will be printed' + 'value to set the config option to; when omitted, the existing value is printed; with --value-from-file, this is treated as a file pat' + )->addOption( + 'value-from-file', + null, + InputOption::VALUE_NONE, + 'treat the value argument as a file path and read the config value from that file' ); parent::configure(); } @@ -58,6 +64,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);