celluloid / reel

UNMAINTAINED: See celluloid/celluloid#779 - Celluloid::IO-powered web server
https://celluloid.io
MIT License
596 stars 87 forks source link

Server configuration by block, versus by initialization options. #209

Open digitalextremist opened 9 years ago

digitalextremist commented 9 years ago

Implement this style of configuration, which sets the defaults used by the actual Reel::Server constructor... meaning they can be overridden directly at instantiation, if desired:

#de Can be either `Reel.configure` or `Ree::Server.configure`
Reel.configure { |config|
  config.host = '0.0.0.0'
  config.port = 8888
}

Reel.configure(host: '0.0.0.0', port: 8888)
dilumn commented 9 years ago

So is it going to be something like this in Reel?

class << self
    def configure

    end
end

But Reel::Server constructor require server for initialisation. Did you mean Reel::Server::HTTP & Reel::Server::HTTPS for this feature??

digitalextremist commented 9 years ago

The implementation you posted is more of a shortcut for Server.new which hard-codes HTTP

We need to be able to select which server type, so server: or config.server with either a class passed in or a symbol ( :HTTP, :HTTPS, or :UNIX for example )

If the block approach is used, class variables need to be set, and those values need to be used for the default initialization of the server.