Sha256: 953c972d75739367e5a618ca0e8a7bb4dfbe434a6056bdf60a7fdd1ecc4acda5

Contents?: true

Size: 913 Bytes

Versions: 5

Compression:

Stored size: 913 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' => '/',
        'keep_hours' => 24
    }
}

module Perus::Server
    class Server
        def initialize(options_path = DEFAULT_SERVER_OPTIONS_PATH, environment = 'development')
            self.class.options.load(options_path, DEFAULT_SERVER_OPTIONS)
            ENV['RACK_ENV'] = environment
            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

5 entries across 5 versions & 1 rubygems

Version Path
perus-0.1.7 lib/perus/server/server.rb
perus-0.1.6 lib/perus/server/server.rb
perus-0.1.5 lib/perus/server/server.rb
perus-0.1.4 lib/perus/server/server.rb
perus-0.1.3 lib/perus/server/server.rb