module Credentials
Constants
- NESTING_DELIMINATOR
- VERSION
Public Class Methods
all()
click to toggle source
# File lib/credentials.rb, line 15 def all secrets end
get(*args)
click to toggle source
# File lib/credentials.rb, line 10 def get(*args) keys = get_key_array(args) get_value keys end
Private Class Methods
environment()
click to toggle source
# File lib/credentials.rb, line 30 def environment Rails.env || ENV['RAILS_ENV'] || 'development' end
get_key_array(args)
click to toggle source
# File lib/credentials.rb, line 34 def get_key_array(args) args.map do |arg| case arg when String arg.split(NESTING_DELIMINATOR) when Array arg when Symbol [arg.to_s] end.map(&:to_sym) end.flatten end
get_value(key_ary)
click to toggle source
# File lib/credentials.rb, line 21 def get_value(key_ary) secrets.dig(*key_ary) end
secrets()
click to toggle source
# File lib/credentials.rb, line 25 def secrets # TODO: This should be swappable and configurable. Rails.application.credentials[environment.to_sym] || Rails.application.credentials end