    # File lib/chef/knife.rb, line 289
        def configure_chef
          unless config[:config_file]
            if self.class.chef_config_dir
              candidate_config = File.expand_path('knife.rb',self.class.chef_config_dir)
              config[:config_file] = candidate_config if File.exist?(candidate_config)
            end
            # If we haven't set a config yet and $HOME is set, and the home
            # knife.rb exists, use it:
            if (!config[:config_file]) && ENV['HOME'] && File.exist?(File.join(ENV['HOME'], '.chef', 'knife.rb'))
              config[:config_file] = File.join(ENV['HOME'], '.chef', 'knife.rb')
            end
          end

          # Don't try to load a knife.rb if it doesn't exist.
          if config[:config_file]
            read_config_file(config[:config_file])
          else
            # ...but do log a message if no config was found.
            Chef::Config[:color] = config[:color] && !config[:no_color]
            ui.warn("No knife configuration file found")
          end

          Chef::Config[:color] = config[:color] && !config[:no_color]

          case config[:verbosity]
          when 0
            Chef::Config[:log_level] = :error
          when 1
            Chef::Config[:log_level] = :info
          else
            Chef::Config[:log_level] = :debug
          end

          Chef::Config[:node_name]         = config[:node_name]       if config[:node_name]
          Chef::Config[:client_key]        = config[:client_key]      if config[:client_key]
          Chef::Config[:chef_server_url]   = config[:chef_server_url] if config[:chef_server_url]
          Chef::Config[:environment]       = config[:environment]     if config[:environment]

          # Expand a relative path from the config directory. Config from command
          # line should already be expanded, and absolute paths will be unchanged.
          if Chef::Config[:client_key] && config[:config_file]
            Chef::Config[:client_key] = File.expand_path(Chef::Config[:client_key], File.dirname(config[:config_file]))
          end

          Mixlib::Log::Formatter.show_time = false
          Chef::Log.init(Chef::Config[:log_location])
          Chef::Log.level(Chef::Config[:log_level] || :error)

          Chef::Log.debug("Using configuration from #{config[:config_file]}")

          if Chef::Config[:node_name].nil?
            #raise ArgumentError, "No user specified, pass via -u or specifiy 'node_name' in #{config[:config_file] ? config[:config_file] : "~/.chef/knife.rb"}"
          end
        end