使用 figaro 管理密码

  1. 安装 figaro
    gem figaro 加到gemfile 中
    bundle install
    figaro install
    会自动生成 config/application.yml 文件并自动添加到 .gitignore 档案里

  2. 设置机密信息
    cp config/application.yml config/application.yml.example
    application.yml 被加入到 .gitignore 中,为了方便协作,把 application.yml 复制一个样例放入 application.yml.example 中

  3. figaro 配置到 heroku 环境变量中
    figaro heroku:set -e production
    这会把 config/application.yml 中设置的变量写入 heroku 环境变量中,使用 heroku config 可以列出目前所有的配置

如何在 Heroku 设置环境变数,参考 https://devcenter.heroku.com/articles/config-vars

如何在本地设置环境变数,参考 http://thejavashop.net/blog/?p=5