2017-02-12 67 views
0

如何在执行语句Capistrano任务中传递--env变量“staging or production”?Capistrano任务启动/重新启动pm2如何传递--env变量

def restart_app 
    within current_path do 
     execute :pm2, :restart, fetch(:app_command) 
    end 
    end 

    def start_app 
    within current_path do 
     execute :pm2, :stop, fetch(:app_command) 
    end 
    end 

目前一旦开始,process.env.NODE_ENV未定义

+0

有线索阅读以下帖子 http://stackoverflow.com/questions/19452983/capistrano-3-execute-within-a-directory – erwin

回答

0

我使用的电流路径中,我应该改变执行命令“保留的范围内(所有细微之处),用( ),default_env等,同时仍保持自然字符串语法:”

内的current_path做

执行 *%W [PM2重启hello.js --env分期] 结束