Skip to content

Commit

Permalink
Add listen_ip option to server and web interface
Browse files Browse the repository at this point in the history
  • Loading branch information
robgolding committed Mar 13, 2011
1 parent 2908f50 commit 5eed397
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backtrac/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def requestAvatarId(self, credentials):
client)

class BackupServer(object):
def __init__(self, port=8123):
def __init__(self, ip='0.0.0.0', port=8123):
self.port = port
self.clients = {}
self.storage = Storage(settings.BACKTRAC_BACKUP_ROOT)
Expand All @@ -57,7 +57,7 @@ def __init__(self, port=8123):
checker = BackupClientAuthChecker()
self.portal = portal.Portal(realm, [checker])
self.factory = PBServerFactory(self.portal)
self.service = TCPServer(self.port, self.factory)
self.service = TCPServer(self.port, self.factory, interface=ip)
self.restore_loop = LoopingCall(self.execute_pending_restores)
self.restore_loop.start(5)

Expand Down
2 changes: 2 additions & 0 deletions server.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[backtracserverd]

listen_ip = 0.0.0.0
listen_port = 8123
backup_root = /tmp/backtrac/backups

[backtracweb]

listen_ip = 0.0.0.0
listen_port = 8000
3 changes: 2 additions & 1 deletion twisted/plugins/backtracserverd_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ def makeService(self, options):
config = options['config']
cp = self.getConfig(config)
try:
ip = cp.get('backtracserverd', 'listen_ip')
port = cp.getint('backtracserverd', 'listen_port')
server = BackupServer(port=port)
server = BackupServer(ip=ip, port=port)
return server.service
except ConfigParser.Error:
print >> sys.stderr, 'Error parsing config file:', config
Expand Down
3 changes: 2 additions & 1 deletion twisted/plugins/backtracweb_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def makeService(self, options):
config = options['config']
cp = self.getConfig(config)
try:
ip = cp.get('backtracweb', 'listen_ip')
port = cp.getint('backtracweb', 'listen_port')
#application = service.Application('backtracweb')

Expand All @@ -84,7 +85,7 @@ def makeService(self, options):

# create the site and a TCPServer service to serve it with
site = server.Site(root)
ws = internet.TCPServer(port, site)
ws = internet.TCPServer(port, site, interface=ip)

# add the web server service to the multi service
ws.setServiceParent(multi)
Expand Down

0 comments on commit 5eed397

Please sign in to comment.