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.
-
.configure_app(options = {}) ⇒ nil
Configure the application.
-
.deconfigure_app(options = {}) ⇒ nil
De-configure the application.
Class Method Details
.api?(req) ⇒ Boolean
Is request part of the API
46 47 48 |
# File 'lib/puppet-herald/app/configuration.rb', line 46 def api?(req) (req.path.start_with?('/api') || req.path.start_with?('/version.json')) end |
.configure_app(options = {}) ⇒ nil
Configure the application
24 25 26 27 28 29 30 31 |
# File 'lib/puppet-herald/app/configuration.rb', line 24 def configure_app( = {}) cron = .fetch(:cron, true) dbmigrate = .fetch(:dbmigrate, true) setup_database_logger dbmigrate! if dbmigrate enable_cron if cron nil end |
.deconfigure_app(options = {}) ⇒ nil
De-configure the application
37 38 39 40 41 |
# File 'lib/puppet-herald/app/configuration.rb', line 37 def deconfigure_app( = {}) cron = .fetch(:cron, true) disable_cron if cron nil end |