Skip to content

Commit

Permalink
Allow to set the URL for the security advisories composer url via env…
Browse files Browse the repository at this point in the history
… variable (#5180)
  • Loading branch information
Cyberschorsch committed Jul 12, 2022
1 parent 7f24f24 commit f324ff5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Commands/pm/SecurityUpdateCommands.php
Expand Up @@ -95,14 +95,20 @@ public function suggestComposerCommand($updates): void
/**
* Fetches the generated composer.json from drupal-security-advisories.
*
* This function fetches the generated composer.json from the
* drupal-security-advisories repository or fetches it from another source
* if the environment variable DRUSH_SECURITY_ADVISORIES_URL is set. The
* environment variable is not a supported API.
*
* @return mixed
*
* @throws \Exception
*/
protected function fetchAdvisoryComposerJson()
{
$client = new Client(['handler' => $this->getStack()]);
$response = $client->get('https://raw.githubusercontent.com/drupal-composer/drupal-security-advisories/9.x/composer.json');
$security_advisories_composer_url = getenv('DRUSH_SECURITY_ADVISORIES_URL') ?: 'https://raw.githubusercontent.com/drupal-composer/drupal-security-advisories/9.x/composer.json';
$response = $client->get($security_advisories_composer_url);
$security_advisories_composer_json = json_decode($response->getBody(), true);
return $security_advisories_composer_json;
}
Expand Down

0 comments on commit f324ff5

Please sign in to comment.