[RAILS] credentials.yml.enc and master.key <Notes>

concept

credentials.yml.enc and master.key

Mechanism for managing confidential information of apps that appeared in Rails 5.2

master.key A file containing the private key for decrypting the encrypted secret information written in credentials.yml.enc

credentials.yml.enc An encrypted file of credentials.yml

credentials.yml File with confidential information

how to use

When editing confidential information

Instead of editing credentials.yml.enc directly, edit it with the following command

EDITOR='vim' rails credentials:edit

Why not edit credentials.yml.enc directly?

Because credentials.yml.enc is an encrypted file and you can't edit it. (.enc means encrypted file)

When calling confidential information

After launching Rails console, type the following command

Rails.application.credentials[:Confidential information you want to get]

reference

https://hirocorpblog.com/rails-credentials-master/#toc1

Recommended Posts

credentials.yml.enc and master.key <Notes>
Modules and Mixins notes
Production environment and credentials.yml.enc
[Java] Basic types and instruction notes
Internal class and lambda study notes
Notes on Java path and Package
Notes on expand () and collapse () of Expandablerecyclerview
Notes on Java's Stream API and SQL
Rails validation and null: false Personal notes