How can I instruct Capistrano 3 to load my shell environment variables set at remote host?

后端 未结 4 1138
有刺的猬
有刺的猬 2021-02-05 16:00

I want to instruct Capistrano to load environment variables that are defined on remote server. How can I do that?

It seems that when I export my environment variables in

4条回答
  •  感情败类
    2021-02-05 16:23

    Although this question is over six months old now, I'll leave this here in case anyone is facing this same problem.

    Capistrano actually does load .bashrc. But near the top of the file you will find:

    # If not running interactively, don't do anything
    [ -z "$PS1" ] && return
    

    If you do any exporting after that line, it will not be reached by Capistrano. The solution was simply to put my setup above this and Capistrano works how I want.

    This solution was also noted at this GitHub issue.

提交回复
热议问题