From 56291d33c815c4819061514c589658c8654f10cb Mon Sep 17 00:00:00 2001 From: Hubert Viktor Date: Tue, 19 May 2015 13:03:31 +0200 Subject: [PATCH] The server function now automatically registers the 'name' and 'host' environment variables, based on the given parameters. --- src/functions.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/functions.php b/src/functions.php index c6e8ee39..3dcc9286 100644 --- a/src/functions.php +++ b/src/functions.php @@ -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); }