Sha256: 5f13cff9716bae3e2a4c21c4abee16578d28e4e35d0e06da5bfe916b1245fcee
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
module QPush module Server include QPush::Base::ConfigHelper class << self attr_accessor :worker, :keys def config @config ||= Config.new end end class WorkerConfig DEFAULTS = { namespace: 'default', priorities: 5, queue_threads: 2, perform_threads: 2, delay_threads: 1 }.freeze attr_accessor :perform_threads, :queue_threads, :delay_threads, :namespace, :priorities def initialize(options = {}) options = DEFAULTS.merge(options) options.each { |key, value| send("#{key}=", value) } end def for_keys { namespace: @namespace, priorities: @priorities } end end class Config < QPush::Base::Config SERVER_DEFAULTS = { database_url: ENV['DATABASE_URL'], database_pool: 10, jobs_path: '/jobs', workers: [WorkerConfig.new] }.freeze attr_accessor :database_url, :database_pool, :jobs_path, :workers def initialize super SERVER_DEFAULTS.each { |key, value| send("#{key}=", value) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
qpush-0.1.7 | lib/qpush/server/config.rb |
qpush-0.1.6 | lib/qpush/server/config.rb |