0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

HerokuでRails credentialsを設定する

Posted at

概要

Herokuでcredentialsを設定する際に困ったのでメモ

環境

ruby ruby 2.7.1p83
Rails 6.0.3.2

初期設定

まずcredentialsを利用するためにkey設定をオンにする

config/credentials/production.rb
config.require_master_key = true

Rails 5.2で設定

herokuにログインして、RAILS_MASTER_KEYを設定する

heroku config:set RAILS_MASTER_KEY=`cat config/master.key`

Rails 6.0以降で設定

rails 6からcredentialsを環境ごとに分離することができるようになった。Railsガイド 主な変更
もし、環境を分離した場合、参照する鍵のパスを変えなければいけない。

# productionの場合
heroku config:set RAILS_MASTER_KEY=`cat config/credentials/production.key`
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?