setName('app_api:app:config:list'); $this->setDescription('List ExApp configs'); $this->addArgument('appid', InputArgument::REQUIRED); $this->addOption('private', null, InputOption::VALUE_NONE, 'Include sensitive ExApp config values like secrets, passwords, etc.'); } protected function execute(InputInterface $input, OutputInterface $output): int { $appId = $input->getArgument('appid'); $exApp = $this->service->getExApp($appId); if ($exApp === null) { $output->writeln(sprintf('ExApp %s not found.', $appId)); return 1; } $exAppConfigs = $this->appConfigService->getAllAppConfig($exApp->getAppid()); $private = $input->getOption('private'); $output->writeln(sprintf('ExApp %s configs:', $exApp->getAppid())); $appConfigs = []; foreach ($exAppConfigs as $exAppConfig) { $appConfigs[$exAppConfig->getAppid()][$exAppConfig->getConfigkey()] = ($private && !$exAppConfig->getSensitive() ? $exAppConfig->getConfigvalue() : self::SENSITIVE_VALUE); } $output->writeln(json_encode($appConfigs, JSON_PRETTY_PRINT)); return 0; } }