I'm looking how I can set up host user and pass from env
this don't work - need string not function
host('51.38.98.87')
->stage('production')
->user( function(){return getenv('PRODUCTION_USER'); )
->pass( function(){return getenv('PRODUCTION_PASS'); )
->port(22)
in Symfony 4 I use env and don't want setup hosts in ~/.ssh/config
Update1 :
<?php
namespace Deployer;
use Symfony\Component\Dotenv\Dotenv;
require 'recipe/symfony.php';
require_once 'vendor/autoload.php';
$dotenv = new Dotenv();
$dotenv->load(__DIR__.'/.env');
then
dep deploy production
get
dep deploy production
[Error] Class 'Symfony\Component\Dotenv\Dotenv' not found
#0 phar:///usr/local/bin/dep/src/Deployer.php(325): require()
#1 [internal function]: Deployer\Deployer::Deployer\{closure}()
#2 phar:///usr/local/bin/dep/src/Deployer.php(326): call_user_func(Object(Closure))
#3 phar:///usr/local/bin/dep/bin/dep(119): Deployer\Deployer::run('6.3.0',
Update 2
composer.json has symfony/dotenv
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"symfony/browser-kit": "^4.0",
"symfony/css-selector": "^4.0",
"symfony/debug-pack": "*",
"symfony/dotenv": "^4.0",
"symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "^4.0",
"symfony/profiler-pack": "*",
"symfony/web-server-bundle": "^4.0"
},
but still
namespace Deployer;
use Symfony\Component\Dotenv\Dotenv;
require 'vendor/autoload.php';
require 'recipe/symfony.php';
$dotenv = new Dotenv();
$dotenv->load(__DIR__.'/.env');
give my
Class 'Symfony\Component\Dotenv\Dotenv' not found
#0 phar:///usr/local/bin/dep/src/Deployer.php(325): require()
#1 [internal function]: Deployer\Deployer::Deployer\{closure}()
#2 phar:///usr/local/bin/dep/src/Deployer.php(326): call_user_func(Object(Closure))
#3 phar:///usr/local/bin/dep/bin/dep(119): Deployer\Deployer::run('6.3.0', '/home/grek/Phps...')
#4 /usr/local/bin/dep(4): require('phar:///usr/loc...')
#5 {main}
UPDATE 3
I create test file : ./test.php
<?php
use Symfony\Component\Dotenv\Dotenv;
require 'vendor/autoload.php';
(new Dotenv())->load(__DIR__.'/.env');
php test.php works fine.
Run from same location dep deploy:staging
give my
[Error] Class 'Symfony\Component\Dotenv\Dotenv' not found
#0 phar:///usr/local/bin/dep/src/Deployer.php(325): require()
my deploy.php file
<?php
namespace Deployer;
use Symfony\Component\Dotenv\Dotenv;
require 'vendor/autoload.php';
require 'recipe/symfony.php';
(new Dotenv())->load(__DIR__.'/.env');
Deployer is installed globaly
whereis dep
dep: /usr/local/bin/dep