#!/usr/local/bin/ruby181.8
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.

require 'rubygems'
require 'rails/commands/server'
require 'rack'
require 'webrick'
require 'webrick/https'

module Rails
    class Server < ::Rack::Server
        def default_options
            super.merge({
                :Port => 3004,
                :Host => "127.0.0.1",
                :environment => (ENV['RAILS_ENV'] || "development").dup,
                :daemonize => false,
                :debugger => false,
                :pid => File.expand_path("tmp/pids/server.pid"),
                :config => File.expand_path("config.ru"),
                :SSLEnable => true,
                :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
                :SSLPrivateKey => OpenSSL::PKey::RSA.new(
                       File.open(File.expand_path( '../../config/ssl/server.key.insecure', __FILE__)).read),
                :SSLCertificate => OpenSSL::X509::Certificate.new(
                       File.open(File.expand_path('../../config/ssl/server.crt', __FILE__)).read),
                :SSLCertName => [["CN", WEBrick::Utils::getservername]]
            })
        end
    end
end


APP_PATH = File.expand_path('../../config/application',  __FILE__)
require File.expand_path('../../config/boot',  __FILE__)
require 'rails/commands'
