1

The first line of my ~/.profile file is:

export DEVISE_TOKEN_AUTH_SECRET_KEY="secrethere"

When I SSH in to my deployer account, echo $DEVISE_TOKEN_AUTH_SECRET_KEY prints the secret key normally. However, when running

cap production deploy

I get

Devise.secret_key was not set

Any ideas why?

1 Answers1

2

Capistrano makes its connection as a non-login, non-interactive shell. It will not automatically evaluate the various home scripts.

How Capistrano makes its connection is described here: http://capistranorb.com/documentation/advanced-features/ptys/

What files are evaluated on the various shell modes is described here: https://github.com/rbenv/rbenv/wiki/Unix-shell-initialization#bash

A number of other ways to set environment variables is shown here: Capistrano: Can I set an environment variable for the whole cap session?

A duplicate question is here: https://superuser.com/questions/564926/profile-is-not-loaded-when-using-ssh-ubuntu

The FAQ section for this question is here: http://capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/

From this last link, we see that ~/.bashrc might work.

will_in_wi
  • 2,623
  • 1
  • 16
  • 21