Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/Console/Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Composer\Config;
use Composer\Config\JsonConfigSource;
use Composer\Console\Application as ComposerApplication;
use Composer\IO\IOInterface;
use Composer\Json\JsonFile;
use Composer\Json\JsonValidationException;
use Composer\Package\Loader\RootPackageLoader;
Expand Down Expand Up @@ -127,7 +128,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

// load auth.json authentication information and pass it to the io interface
$io = $this->getIO();
$io->loadConfiguration($this->getConfiguration());
$baseConfig = $this->getConfiguration();
$config = [];

if (1 === preg_match('{^https?://}i', $configFile)) {
Expand All @@ -147,8 +148,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 1;
}
$config = $file->read();

// load project auth file
$realConfigPath = realpath($configFile);
$localAuthFile = new JsonFile(dirname(false !== $realConfigPath ? $realConfigPath : $configFile) . '/auth.json', null, $io);
if ($localAuthFile->exists()) {
$io->writeError('Loading project auth file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
$localAuthFile->validateSchema(JsonFile::AUTH_SCHEMA);
$baseConfig->merge(['config' => $localAuthFile->read()], $localAuthFile->getPath());
$baseConfig->setLocalAuthConfigSource(new JsonConfigSource($localAuthFile, true));
}
}

$io->loadConfiguration($baseConfig);

try {
$this->check($configFile);
} catch (JsonValidationException $e) {
Expand Down