Class: QPush::Server::Config

Inherits:
Base::Config show all
Includes:
ObjectValidator::Validate
Defined in:
lib/qpush/server/config.rb

Constant Summary collapse

SERVER_DEFAULTS =
{
database_url: ENV['DATABASE_URL'],
database_pool: 10,
jobs_path: '/jobs',
workers: [WorkerConfig.new] }.freeze

Constants inherited from Base::Config

Base::Config::DEFAULTS

Instance Attribute Summary collapse

Attributes inherited from Base::Config

#redis_pool, #redis_url

Instance Method Summary collapse

Methods inherited from Base::Config

#redis

Constructor Details

#initializeConfig

Returns a new instance of Config.



25
26
27
28
# File 'lib/qpush/server/config.rb', line 25

def initialize
  super
  SERVER_DEFAULTS.each { |key, value| send("#{key}=", value) }
end

Instance Attribute Details

#database_poolObject

Returns the value of attribute database_pool.



23
24
25
# File 'lib/qpush/server/config.rb', line 23

def database_pool
  @database_pool
end

#database_urlObject

Returns the value of attribute database_url.



23
24
25
# File 'lib/qpush/server/config.rb', line 23

def database_url
  @database_url
end

#jobs_pathObject

Returns the value of attribute jobs_path.



23
24
25
# File 'lib/qpush/server/config.rb', line 23

def jobs_path
  @jobs_path
end

#workersObject

Returns the value of attribute workers.



23
24
25
# File 'lib/qpush/server/config.rb', line 23

def workers
  @workers
end

Instance Method Details

#validate!Object



30
31
32
33
# File 'lib/qpush/server/config.rb', line 30

def validate!
  return if valid?
  fail ServerError, errors.full_messages.join(' ')
end