Sha256: 17041c4fdd19467a6357eb62cedfab118a410cc5a787700f2e8aaadff1b477d2
Contents?: true
Size: 1002 Bytes
Versions: 1
Compression:
Stored size: 1002 Bytes
Contents
require 'committee' require 'rails' class Error < StandardError; end class Railtie < Rails::Railtie initializer "commitee.insert_middleware" do |app| begin schema_path = File.join(Rails.root, "config/schema.json") # check if schema file exists in config/ if File.exists?(schema_path) app.config.middleware.use Committee::Middleware::RequestValidation, schema_path: schema_path, coerce_date_times: true, params_key: 'action_dispatch.request.request_parameters', query_hash_key: 'action_dispatch.request.query_parameters' app.config.middleware.use Committee::Middleware::ResponseValidation, schema_path: schema_path else puts "Need schema.json in \"config/\" directory" puts "Try re-running \"rails g firetail:install\" again" end rescue puts "Need schema.json in \"config/\" directory" puts "Try re-running \"rails g firetail:install\" again" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
firetail-0.0.1.pre.alpha | lib/railtie.rb |