Store and reload the github token to/from the config
parent
503234451b
commit
a9811c4e40
|
@ -140,6 +140,13 @@ class Factory
|
|||
$config = static::createConfig();
|
||||
$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');
|
||||
$binDir = $config->get('bin-dir');
|
||||
|
||||
|
|
|
@ -373,6 +373,11 @@ class GitHubDriver extends VcsDriver
|
|||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue