1
0
Fork 0

Store and reload the github token to/from the config

pull/1191/merge
Jordi Boggiano 2012-10-18 16:40:36 +02:00
parent 503234451b
commit a9811c4e40
2 changed files with 12 additions and 0 deletions

View File

@ -140,6 +140,13 @@ class Factory
$config = static::createConfig(); $config = static::createConfig();
$config->merge($localConfig); $config->merge($localConfig);
// reload oauth token from config if available
if ($tokens = $config->get('github-oauth')) {
foreach ($tokens as $domain => $token) {
$io->setAuthorization($domain, $token, 'x-oauth-basic');
}
}
$vendorDir = $config->get('vendor-dir'); $vendorDir = $config->get('vendor-dir');
$binDir = $config->get('bin-dir'); $binDir = $config->get('bin-dir');

View File

@ -373,6 +373,11 @@ class GitHubDriver extends VcsDriver
$this->io->setAuthorization($this->originUrl, $contents['token'], 'x-oauth-basic'); $this->io->setAuthorization($this->originUrl, $contents['token'], 'x-oauth-basic');
// store value in user config
$githubTokens = $this->config->get('github-oauth') ?: array();
$githubTokens[$this->originUrl] = $contents['token'];
$this->config->getConfigSource()->addConfigSetting('github-oauth', $githubTokens);
return; return;
} }