Method: Mongrel2::Config.configure

Defined in:
lib/mongrel2/config.rb

.configure(config = nil) ⇒ Object

Configurability API – called when the configuration is loaded with the ‘mongrel2’ section of the config file if there is one. This method can also be used without Configurability by passing an object that can be merged with Mongrel2::Config::CONFIG_DEFAULTS.



119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/mongrel2/config.rb', line 119

def self::configure( config=nil )
  return unless config

  config = CONFIG_DEFAULTS.merge( config )

  if dbspec = config[ :configdb ]
    # Assume it's a path to a sqlite database if it doesn't have a schema
    dbspec = "%s://%s" % [ self.sqlite_adapter, dbspec ] unless
      dbspec.include?( ':' )
    self.db = Sequel.connect( dbspec )
  end
end