Sha256: a5f10e7cd9804afb15cfce22ebbf65aa7ac9e38212299635c3229b2a3e31e57e

Contents?: true

Size: 814 Bytes

Versions: 5

Compression:

Stored size: 814 Bytes

Contents

require 'toolshed'
require 'toolshed/client'

module Toolshed
  # Password module looks up password from configuration file if its found
  module Password
    def password_from_config(password)
      return '' if password.nil? || password.empty?

      translated_password = Toolshed.configuration
      return password unless translated_password.is_a?(Hash)

      password_parts = password.split(':')
      password_parts.each do |password_part|
        if translated_password[password_part].nil?
          translated_password = password
          break
        end
        translated_password = translated_password[password_part]
      end
      translated_password
    rescue => e
      Toolshed::Logger.instance.fatal e.message
      Toolshed::Logger.instance.fatal e.inspect
      password
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
toolshed-1.0.12 lib/toolshed/password.rb
toolshed-1.0.11 lib/toolshed/password.rb
toolshed-1.0.10 lib/toolshed/password.rb
toolshed-1.0.9 lib/toolshed/password.rb
toolshed-1.0.8 lib/toolshed/password.rb