class Rails::Application

def encrypted(path, key_path: "config/master.key", env_key: "RAILS_MASTER_KEY")

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

# => 123
my_config.foo.bar

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

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

ENV["RAILS_MASTER_KEY"], or from the +config/master.key+ file.
file. By default, the encryption key is taken from either
Returns an ActiveSupport::EncryptedConfiguration instance for an encrypted
def encrypted(path, key_path: "config/master.key", env_key: "RAILS_MASTER_KEY")
  ActiveSupport::EncryptedConfiguration.new(
    config_path: Rails.root.join(path),
    key_path: Rails.root.join(key_path),
    env_key: env_key,
    raise_if_missing_key: config.require_master_key
  )
end