Sha256: 6d807d4bc6bfbff5855fc905497035c594ad35e5fadf68207187d9cd6fc076fa

Contents?: true

Size: 759 Bytes

Versions: 4

Compression:

Stored size: 759 Bytes

Contents

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

puts "Started DRb server on #{DRb.uri}."
puts "DRb Server Access Control List:"
0.step permissions.length-1, 2 do |i|
  puts "   #{permissions[i].upcase} #{permissions[i+1]}"
end

$HUTDOWN.hook do
  DRb.stop_service
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adhearsion-0.7.0 new_projects/helpers/drb_server.rb
adhearsion-0.7.1 new_projects/helpers/drb_server.rb
adhearsion-0.7.2 new_projects/helpers/drb_server.rb
adhearsion-0.7.3 new_projects/helpers/drb_server.rb