Sha256: d129818fcebe8acac44332b46f7e6a57c2eed55cde53b79a33906915b3a1f793
Contents?: true
Size: 983 Bytes
Versions: 1
Compression:
Stored size: 983 Bytes
Contents
# frozen_string_literal: true module Anyway using RubyNext 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 ||= begin ::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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
anyway_config-2.1.0 | lib/anyway/rails/loaders/secrets.rb |