Deployer\Builder\BuilderInterface::identityFile PHP Method

identityFile() public method

Authenticate with public key
public identityFile ( string $publicKeyFile = '~/.ssh/id_rsa.pub', string $privateKeyFile = '~/.ssh/id_rsa', string $passPhrase = '' ) : Deployer\Builder\BuilderInterface
$publicKeyFile string
$privateKeyFile string
$passPhrase string
return Deployer\Builder\BuilderInterface
    public function identityFile($publicKeyFile = '~/.ssh/id_rsa.pub', $privateKeyFile = '~/.ssh/id_rsa', $passPhrase = '');

Usage Example

 /**
  * @param Collection $config
  * @param BuilderInterface $builder
  */
 private function executeBuilderMethods(Collection $config, BuilderInterface $builder)
 {
     if ($config->has('identity_file')) {
         if ($config['identity_file'] === null) {
             $builder->identityFile();
         } else {
             $builder->identityFile($config['identity_file']['public_key'], $config['identity_file']['private_key'], $config['identity_file']['password']);
         }
         unset($config['identity_file']);
     }
     if ($config->has('identity_config')) {
         if ($config['identity_config'] === null) {
             $builder->configFile();
         } else {
             $builder->configFile($config['identity_config']);
         }
         unset($config['identity_config']);
     }
     if ($config->has('forward_agent')) {
         $builder->forwardAgent();
         unset($config['forward_agent']);
     }
     foreach (['user', 'password', 'stage', 'pem_file'] as $key) {
         if ($config->has($key)) {
             $method = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $key))));
             $builder->{$method}($config[$key]);
             unset($config[$key]);
         }
     }
     // Everything else are set vars.
     foreach ($config->toArray() as $key => $value) {
         $builder->set($key, $value);
     }
 }