The server function now automatically registers the 'name' and 'host' environment variables, based on the given parameters.

This commit is contained in:
Hubert Viktor 2015-05-19 13:03:31 +02:00
parent a554494ff3
commit 56291d33c8

View File

@ -35,12 +35,12 @@ use Symfony\Component\Console\Output\OutputInterface;
* @param int $port
* @return Builder
*/
function server($name, $domain = null, $port = 22)
function server($name, $host = null, $port = 22)
{
$deployer = Deployer::get();
$env = new Environment();
$config = new Configuration($name, $domain, $port);
$config = new Configuration($name, $host, $port);
if ($deployer->parameters->has('ssh_type') && $deployer->parameters->get('ssh_type') === 'ext-ssh2') {
$server = new Remote\SshExtension($config);
@ -51,6 +51,10 @@ function server($name, $domain = null, $port = 22)
$deployer->servers->set($name, $server);
$deployer->environments->set($name, $env);
// Setting environment variables about the server automatically
$env->set('name', $server);
$env->set('host', $host);
return new Builder($config, $env);
}