Class: PuppetHerald::App::Configuration
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- PuppetHerald::App::Configuration
- Defined in:
- lib/puppet-herald/app/configuration.rb
Overview
A configuration for application
Class Method Summary collapse
-
.api?(req) ⇒ Boolean
Is request part of the API.
-
.dbmigrate! ⇒ nil
Migrates a database to state desired for the application.
Class Method Details
.api?(req) ⇒ Boolean
Is request part of the API
33 34 35 |
# File 'lib/puppet-herald/app/configuration.rb', line 33 def api?(req) (req.path.start_with?('/api') || req.path.start_with?('/version.json')) end |
.dbmigrate! ⇒ nil
Migrates a database to state desired for the application
22 23 24 25 26 27 28 |
# File 'lib/puppet-herald/app/configuration.rb', line 22 def dbmigrate! ActiveRecord::Base.establish_connection(PuppetHerald.database.spec) setup_database_logger ActiveRecord::Migrator.up 'db/migrate' ActiveRecord::Base.clear_active_connections! nil end |