ruby-on-rails – Rails 4.2 database.yml不读取rbenv-vars变量

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Rails 4.2 database.yml不读取rbenv-vars变量前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的VPS安装了 rbenv-vars,我在rails app里面的config目录下找到.rbenv-vars文件.我假装在其中加载数据库密码,但我做错了,因为rake db:create给了我一个无密码错误.当我将密码写为字符串时,Rake工作.

config/.rbenv-vars

DB_PASS=my_db_password

config/database.yml

password: $DB_PASS                # Doesn't work
  #password: <%= ENV['DB_PASS'] %>  # Doesn't work
  # password: my_db_password        # Works

我得到所有变量运行rbenv变量

ssh > rbenv vars

export DB_PASS='my_db_password'

解决方法

通过 https://github.com/rails/rails/issues/19256#issuecomment-102980786

你可能需要做一个

spring stop

然后再试一次.这对我有用.

原文链接:https://www.f2er.com/ruby/264853.html

猜你在找的Ruby相关文章