# File lib/puma/control_cli.rb, line 83
    def prepare_configuration
      if @options.has_key? :status_path
        unless File.exist? @options[:status_path]
          raise "Status file not found: #{@options[:status_path]}"
        end

        status = YAML.load File.read(@options[:status_path])

        if status.kind_of?(Hash) && status.has_key?("config")

          conf = status["config"]

          # get control_url
          if url = conf.options[:control_url]
            @options[:control_url] = url
          end

          # get control_auth_token
          if token = conf.options[:control_auth_token]
            @options[:control_auth_token] = token
          end

          # get pid
          @options[:pid] = status["pid"].to_i
        else
          raise "Invalid status file: #{@options[:status_path]}"
        end

      elsif @options.has_key? :pid_file
        # get pid from pid_file
        @options[:pid] = File.open(@options[:pid_file]).gets.to_i
      end
    end