comparison idavoll/tap.py @ 170:958e69630e52

Provide twistd parameters for connecting to a remote PostgreSQL database. Author: edwinm (ralphm) Reviewer: ralphm Fixes #6.
author Ralph Meijer <ralphm@ik.nu>
date Tue, 09 Oct 2007 10:20:25 +0000
parents 96afb248df5e
children 17fc5dd77158
comparison
equal deleted inserted replaced
169:96afb248df5e 170:958e69630e52
14 14
15 __version__ = '0.6.0' 15 __version__ = '0.6.0'
16 16
17 class Options(usage.Options): 17 class Options(usage.Options):
18 optParameters = [ 18 optParameters = [
19 ('jid', None, 'pubsub'), 19 ('jid', None, 'pubsub', 'JID this component will be available at'),
20 ('secret', None, 'secret'), 20 ('secret', None, 'secret', 'Jabber server component secret'),
21 ('rhost', None, '127.0.0.1'), 21 ('rhost', None, '127.0.0.1', 'Jabber server host'),
22 ('rport', None, '5347'), 22 ('rport', None, '5347', 'Jabber server port'),
23 ('backend', None, 'memory'), 23 ('backend', None, 'memory', 'Choice of storage backend'),
24 ('dbuser', None, ''), 24 ('dbuser', None, '', 'Database user (pgsql backend)'),
25 ('dbname', None, 'pubsub'), 25 ('dbname', None, 'pubsub', 'Database name (pgsql backend)'),
26 ('dbpass', None, ''), 26 ('dbpass', None, '', 'Database password (pgsql backend)'),
27 ('dbhost', None, '', 'Database host (pgsql backend)'),
28 ('dbport', None, '', 'Database port (pgsql backend)'),
27 ] 29 ]
28 30
29 optFlags = [ 31 optFlags = [
30 ('verbose', 'v', 'Show traffic'), 32 ('verbose', 'v', 'Show traffic'),
31 ('hide-nodes', None, 'Hide all nodes for disco') 33 ('hide-nodes', None, 'Hide all nodes for disco')
53 55
54 if config['backend'] == 'pgsql': 56 if config['backend'] == 'pgsql':
55 from idavoll.pgsql_storage import Storage 57 from idavoll.pgsql_storage import Storage
56 st = Storage(user=config['dbuser'], 58 st = Storage(user=config['dbuser'],
57 database=config['dbname'], 59 database=config['dbname'],
58 password=config['dbpass']) 60 password=config['dbpass'],
61 host=config['dbhost'],
62 port=config['dbport'])
59 elif config['backend'] == 'memory': 63 elif config['backend'] == 'memory':
60 from idavoll.memory_storage import Storage 64 from idavoll.memory_storage import Storage
61 st = Storage() 65 st = Storage()
62 66
63 bs = BackendService(st) 67 bs = BackendService(st)