1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Allow a different SSH host to be set in Diffusion

Summary:
Ref T6941. In the cluster (and in other reasonable setups) we've separated SSH load balancers from HTTP load balancers.

In particular, ELBs will not let you load balance port 22, so this is likely a reasonable/common issue in larger clusters in AWS.

Allow users to specify an alternate host for SSH traffic.

Test Plan: Set host to someting different, saw it reflected in UI.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6941

Differential Revision: https://secure.phabricator.com/D11800
This commit is contained in:
epriestley 2015-02-18 10:51:14 -08:00
parent 0b2697bb92
commit 02b174c2af
3 changed files with 17 additions and 0 deletions

View file

@ -19,6 +19,7 @@ $args->setSynopsis(<<<EOSYNOPSIS
EOSYNOPSIS EOSYNOPSIS
); );
$args->parseStandardArguments();
$args->parse( $args->parse(
array( array(
array( array(

View file

@ -113,6 +113,7 @@ final class PhabricatorDiffusionConfigOptions
"Consider using SSH for authenticated access to repositories ". "Consider using SSH for authenticated access to repositories ".
"instead of HTTP.")), "instead of HTTP.")),
$this->newOption('diffusion.ssh-user', 'string', null) $this->newOption('diffusion.ssh-user', 'string', null)
->setLocked(true)
->setSummary(pht('Login username for SSH connections to repositories.')) ->setSummary(pht('Login username for SSH connections to repositories.'))
->setDescription( ->setDescription(
pht( pht(
@ -120,12 +121,22 @@ final class PhabricatorDiffusionConfigOptions
'fill in this login username. If you have configured a VCS user '. 'fill in this login username. If you have configured a VCS user '.
'like `git`, you should provide it here.')), 'like `git`, you should provide it here.')),
$this->newOption('diffusion.ssh-port', 'int', null) $this->newOption('diffusion.ssh-port', 'int', null)
->setLocked(true)
->setSummary(pht('Port for SSH connections to repositories.')) ->setSummary(pht('Port for SSH connections to repositories.'))
->setDescription( ->setDescription(
pht( pht(
'When constructing clone URIs to show to users, Diffusion by '. 'When constructing clone URIs to show to users, Diffusion by '.
'default will not display a port assuming the default for your '. 'default will not display a port assuming the default for your '.
'VCS. Explicitly declare when running on a non-standard port.')), 'VCS. Explicitly declare when running on a non-standard port.')),
$this->newOption('diffusion.ssh-host', 'string', null)
->setLocked(true)
->setSummary(pht('Host for SSH connections to repositories.'))
->setDescription(
pht(
'If you accept Phabricator SSH traffic on a different host '.
'from web traffic (for example, if you use different SSH and '.
'web load balancers), you can set the SSH hostname here. This '.
'is an advanced option.')),
); );
} }

View file

@ -1006,6 +1006,11 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
$uri->setUser($ssh_user); $uri->setUser($ssh_user);
} }
$ssh_host = PhabricatorEnv::getEnvConfig('diffusion.ssh-host');
if (strlen($ssh_host)) {
$uri->setDomain($ssh_host);
}
$uri->setPort(PhabricatorEnv::getEnvConfig('diffusion.ssh-port')); $uri->setPort(PhabricatorEnv::getEnvConfig('diffusion.ssh-port'));
return $uri; return $uri;