Sha256: 8a4d13e748bb3f8eaef7daab429979bb8c3604ad8ab593bf4c262c7855cb6f7e
Contents?: true
Size: 923 Bytes
Versions: 2
Compression:
Stored size: 923 Bytes
Contents
# frozen_string_literal: true module Anyway module Rails module Loaders class Secrets < Anyway::Loaders::Base def call(name:, **_options) return {} unless ::Rails.application.respond_to?(:secrets) # Create a new hash cause secrets are mutable! config = {} trace!(:secrets) do secrets.public_send(name) end.then do |secrets| Utils.deep_merge!(config, secrets) if secrets end config end private def secrets @secrets ||= ::Rails.application.secrets.tap do |_| # Reset secrets state if the app hasn't been initialized # See https://github.com/palkan/anyway_config/issues/14 next if ::Rails.application.initialized? ::Rails.application.remove_instance_variable(:@secrets) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
runger_config-3.0.1 | lib/anyway/rails/loaders/secrets.rb |
runger_config-3.0.0 | lib/anyway/rails/loaders/secrets.rb |