require 'drb' require 'drb/acl' require 'thread' # Load the access control list config = $HELPERS['drb_server'] permissions = [] # For greater control over the ACL if config['raw_acl'] permissions = config['raw_acl'].flatten else [config['deny']].flatten.each { |ip| permissions << "deny" << ip } [config['allow']].flatten.each { |ip| permissions << "allow" << ip } end DRb.install_acl ACL.new(permissions) host = config['host'] || 'localhost' port = config['port'] || 9050 DRb.start_service "druby://#{host}:#{port}", PBX log "Started DRb server on #{DRb.uri}." log "DRb Server Access Control List:" 0.step permissions.length-1, 2 do |i| log " #{permissions[i].upcase} #{permissions[i+1]}" end $HUTDOWN.hook do DRb.stop_service end