class ActiveProjection::Server
Attributes
domain[W]
options[W]
Public Class Methods
new(new_options = nil)
click to toggle source
# File lib/active_projection/server.rb, line 9 def initialize(new_options = nil) self.options = new_options.deep_symbolize_keys! unless new_options.nil? end
run(options = nil)
click to toggle source
# File lib/active_projection/server.rb, line 5 def self.run(options = nil) new(options).run end
Public Instance Methods
config_file()
click to toggle source
# File lib/active_projection/server.rb, line 29 def config_file self.class.config_file ||= File.expand_path('config/disco.yml', base_path) end
env()
click to toggle source
# File lib/active_projection/server.rb, line 17 def env @env = ENV['PROJECTION_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development' end
options()
click to toggle source
# File lib/active_projection/server.rb, line 21 def options @options ||= parse_options(ARGV) end
rails_config_file()
click to toggle source
# File lib/active_projection/server.rb, line 33 def rails_config_file self.class.rails_config_file ||= File.expand_path('config/database.yml', base_path) end
run()
click to toggle source
# File lib/active_projection/server.rb, line 13 def run EventClient.start options end
Private Instance Methods
default_options()
click to toggle source
# File lib/active_projection/server.rb, line 42 def default_options { projection_database: { adapter: 'sqlite3', database: File.expand_path('db/production.sqlite3', base_path), }, event_connection: { scheme: 'amqp', userinfo: nil, host: '127.0.0.1', port: 9797, }, event_exchange: 'events', } end
parse_options(_args)
click to toggle source
# File lib/active_projection/server.rb, line 58 def parse_options(_args) options = default_options options.merge! YAML.load_file(config_file)[env].deep_symbolize_keys! unless config_file.blank? options[:projection_database] = YAML.load_file(rails_config_file)[env].deep_symbolize_keys! unless rails_config_file.blank? options end