method

encrypted

Importance_1
v7.1.3.4 - Show latest stable - 0 notes - Class: Rails::Application
encrypted(path, key_path: "config/master.key", env_key: "RAILS_MASTER_KEY") public

Returns an ActiveSupport::EncryptedConfiguration instance for an encrypted file. By default, the encryption key is taken from either ENV["RAILS_MASTER_KEY"], or from the config/master.key file.

my_config = Rails.application.encrypted("config/my_config.enc")

my_config.read
# => "foo:\n  bar: 123\n"

my_config.foo.bar
# => 123

Encrypted files can be edited with the bin/rails encrypted:edit command. (See the output of bin/rails encrypted:edit --help for more information.)

Show source
Register or log in to add new notes.