class RocketJob::Config
Rocket Job
Configuration
Public Class Methods
filter()
click to toggle source
Returns [Hash] the where clause built from the filters above:
include_filter, exclude_filter, and where_filter.
Returns nil if no filter should be applied.
# File lib/rocket_job/config.rb, line 100 def self.filter raise(ArgumentError, "Cannot supply both an include_filter and an exclude_filter") if include_filter && exclude_filter filter = where_filter (filter ||= {})["_type"] = include_filter if include_filter (filter ||= {})["_type"] = {"$not" => exclude_filter} if exclude_filter filter&.dup end
load!(environment = "development", file_name = nil, encryption_file_name = nil)
click to toggle source
Configure Mongoid
# File lib/rocket_job/config.rb, line 76 def self.load!(environment = "development", file_name = nil, encryption_file_name = nil) config_file = file_name ? Pathname.new(file_name) : Pathname.pwd.join("config/mongoid.yml") raise(ArgumentError, "Mongo Configuration file: #{config_file} not found") unless config_file.file? logger.debug "Reading Mongo configuration from: #{config_file}" ::Mongoid.load!(config_file, environment) config_file = if encryption_file_name Pathname.new(encryption_file_name) else Pathname.pwd.join("config/symmetric-encryption.yml") end return unless config_file.file? logger.debug "Reading SymmetricEncryption configuration from: #{config_file}" SymmetricEncryption.load!(config_file.to_s, environment) end