Sha256: 81a1e97dcec8f9e4e7ec8f379d598b0a096092e8ceab880bccd08d4a0adbff44
Contents?: true
Size: 857 Bytes
Versions: 1
Compression:
Stored size: 857 Bytes
Contents
# frozen_string_literal: true module LdapQuery # If used with a rails application, this allows the the script to pull ldap credentials from Rails.application.credentials class RailsCredentials attr_accessor :credentials # Used to grab the applications encrypted credentials with the ldap key # # @return [Hash] def self.credentials return EMPTY_HASH unless rails? @_credentials ||= Rails.application.credentials[:ldap] rescue # In case an older rails application is used were `Rails.application.credentials` isn't defined raise(CredentialsError, 'Rails.application.credentials could not be found') end # Used to verify `Rails.application` exists within the codebase # # @return [Boolean] def self.rails? (defined?(Rails) && Rails.respond_to?(:application)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ldap_query-0.0.1 | lib/ldap_query/rails_credentials.rb |