Sha256: e7d3650efd822f73fd5eff091cc26f0a3f0e4acf5a71872402633d8eb7bf235e

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

Contents

require 'thin'

DEFAULT_SERVER_OPTIONS = {
    '__anonymous__' => {
        '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

1 entries across 1 versions & 1 rubygems

Version Path
perus-0.1.2 lib/perus/server/server.rb