Module: Herbert::Configurator::Prepatch
- Defined in:
- lib/herbert/Configurator.rb
Overview
Sets up the environment so we can set up Herbert
Class Method Summary collapse
Class Method Details
.registered(app) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/herbert/Configurator.rb', line 8 def self.registered(app) # Enable envs such as development;debug, where debug is herberts debug flag if (ENV['RACK_ENV'] === nil) || (ENV['RACK_ENV'] === 'test') then app.set :environment, :test ENV['HERBERT_DEBUG'] = '1' end if ! app.test? then env = ENV['RACK_ENV'].split(';') ENV['RACK_ENV'], ENV['HERBERT_DEBUG'] = (env[0].empty? ? 'development' : env[0]), (env[1] == 'debug' ? 1:0).to_s app.set :environment, ENV['RACK_ENV'].downcase.to_sym end end |