# File lib/stomp_server.rb, line 42
    def getopts
      copts = OptionParser.new
      copts.on("-C", "--config=CONFIGFILE", String, "Configuration File (default: stompserver.conf)") {|c| @defaults[:configfile] = c}
      copts.on("-p", "--port=PORT", Integer, "Change the port (default: 61613)") {|p| @defaults[:port] = p}
      copts.on("-b", "--host=ADDR", String, "Change the host (default: localhost)") {|a| @defaults[:host] = a}
      copts.on("-q", "--queuetype=QUEUETYPE", String, "Queue type (memory|dbm|activerecord|file) (default: memory)") {|q| @defaults[:queue] = q}
      copts.on("-w", "--working_dir=DIR", String, "Change the working directory (default: current directory)") {|s| @defaults[:working_dir] = s}
      copts.on("-s", "--storage=DIR", String, "Change the storage directory (default: .stompserver, relative to working_dir)") {|s| @defaults[:storage] = s}
      copts.on("-d", "--debug", String, "Turn on debug messages") {|d| @defaults[:debug] = true}
      copts.on("-a", "--auth", String, "Require client authorization") {|a| @defaults[:auth] = true}
      copts.on("-h", "--help", "Show this message") do
        puts copts
        exit
      end
      puts copts.parse(ARGV)

      if File.exists?(@defaults[:configfile])
        opts = @defaults.merge(YAML.load_file(@defaults[:configfile]))
      else
        opts = @defaults
      end

      opts[:etcdir] = File.join(opts[:working_dir],'etc')
      opts[:storage] = File.join(opts[:working_dir],opts[:storage])
      opts[:logdir] = File.join(opts[:working_dir],opts[:logdir])
      opts[:logfile] = File.join(opts[:logdir],opts[:logfile])
      opts[:pidfile] = File.join(opts[:logdir],opts[:pidfile])
      if opts[:auth]
        opts[:passwd] = File.join(opts[:etcdir],'.passwd')
      end

      return opts
    end