Sha256: 492f710b8d5a2e8b2d2d288844d487e15c66216d26fc8bb0523923a66ff66621

Contents?: true

Size: 755 Bytes

Versions: 2

Compression:

Stored size: 755 Bytes

Contents

require 'thin'

DEFAULT_SERVER_OPTIONS = {
    'uploads_dir' => './uploads',
    'uploads_url' => 'http://localhost:3000/uploads/',
    'db_path' => './perus.db',
    'listen' => '0.0.0.0',
    'port' => 3000,
    'site_name' => 'Perus',
    'url_prefix' => '/'
}

module Perus::Server
    class Server
        def initialize(options_path = DEFAULT_SERVER_OPTIONS_PATH)
            self.class.options.load(options_path, DEFAULT_SERVER_OPTIONS)
            DB.start
        end

        def run
            Thin::Server.start(
                self.class.options.listen,
                self.class.options.port.to_i,
                App
            )
        end

        def self.options
            @options ||= Perus::Options.new
        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
perus-0.1.1 lib/perus/server/server.rb
perus-0.1.0 lib/perus/server/server.rb