mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 06:42:41 +01:00
Make --conduit-token work without requiring .arcrc
Summary: Ref T5955. This logic is a little cleaner than the previous version. Don't require `~/.arcrc` to exist if the caller provides `--conduit-token`. Test Plan: - Made calls with `--conduit-token` and no `~/.arcrc`. - Made calls with `--conduit-token` and a normal `~/.arcrc`. - Made calls with normal `arc`. Reviewers: btrahan Reviewed By: btrahan Subscribers: mbishopim3, epriestley Maniphest Tasks: T5955 Differential Revision: https://secure.phabricator.com/D12750
This commit is contained in:
parent
3e36b3fc43
commit
6c5d12d839
2 changed files with 4 additions and 26 deletions
|
@ -204,9 +204,6 @@ try {
|
||||||
if ($force_conduit_version) {
|
if ($force_conduit_version) {
|
||||||
$workflow->forceConduitVersion($force_conduit_version);
|
$workflow->forceConduitVersion($force_conduit_version);
|
||||||
}
|
}
|
||||||
if ($force_token) {
|
|
||||||
$workflow->forceConduitToken($force_token);
|
|
||||||
}
|
|
||||||
if ($conduit_timeout) {
|
if ($conduit_timeout) {
|
||||||
$workflow->setConduitTimeout($conduit_timeout);
|
$workflow->setConduitTimeout($conduit_timeout);
|
||||||
}
|
}
|
||||||
|
@ -316,6 +313,9 @@ try {
|
||||||
$user_name = idx($host_config, 'user');
|
$user_name = idx($host_config, 'user');
|
||||||
$certificate = idx($host_config, 'cert');
|
$certificate = idx($host_config, 'cert');
|
||||||
$conduit_token = idx($host_config, 'token');
|
$conduit_token = idx($host_config, 'token');
|
||||||
|
if ($force_token) {
|
||||||
|
$conduit_token = $force_token;
|
||||||
|
}
|
||||||
|
|
||||||
$description = implode(' ', $original_argv);
|
$description = implode(' ', $original_argv);
|
||||||
$credentials = array(
|
$credentials = array(
|
||||||
|
|
|
@ -48,7 +48,6 @@ abstract class ArcanistWorkflow extends Phobject {
|
||||||
private $conduitCredentials;
|
private $conduitCredentials;
|
||||||
private $conduitAuthenticated;
|
private $conduitAuthenticated;
|
||||||
private $forcedConduitVersion;
|
private $forcedConduitVersion;
|
||||||
private $forcedConduitToken;
|
|
||||||
private $conduitTimeout;
|
private $conduitTimeout;
|
||||||
|
|
||||||
private $userPHID;
|
private $userPHID;
|
||||||
|
@ -252,21 +251,6 @@ abstract class ArcanistWorkflow extends Phobject {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Force use of a specific API token.
|
|
||||||
*
|
|
||||||
* Controlled by the --conduit-token flag.
|
|
||||||
*
|
|
||||||
* @param string API token to use.
|
|
||||||
* @return this
|
|
||||||
* @task conduit
|
|
||||||
*/
|
|
||||||
final public function forceConduitToken($token) {
|
|
||||||
$this->forcedConduitToken = $token;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the protocol version the client should identify with.
|
* Get the protocol version the client should identify with.
|
||||||
*
|
*
|
||||||
|
@ -341,13 +325,7 @@ abstract class ArcanistWorkflow extends Phobject {
|
||||||
// If we have `token`, this server supports the simpler, new-style
|
// If we have `token`, this server supports the simpler, new-style
|
||||||
// token-based authentication. Use that instead of all the certificate
|
// token-based authentication. Use that instead of all the certificate
|
||||||
// stuff.
|
// stuff.
|
||||||
$token = null;
|
$token = idx($credentials, 'token');
|
||||||
if (isset($credentials['token'])) {
|
|
||||||
$token = $credentials['token'];
|
|
||||||
}
|
|
||||||
if ($this->forcedConduitToken) {
|
|
||||||
$token = $this->forcedConduitToken;
|
|
||||||
}
|
|
||||||
if (strlen($token)) {
|
if (strlen($token)) {
|
||||||
$conduit = $this->getConduit();
|
$conduit = $this->getConduit();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue