# HG changeset patch # User Ralph Meijer # Date 1191925225 0 # Node ID 958e69630e52d9aa3a3796945feb8de944d43473 # Parent 96afb248df5e307a49b924738c1965bf0f73aeb0 Provide twistd parameters for connecting to a remote PostgreSQL database. Author: edwinm (ralphm) Reviewer: ralphm Fixes #6. diff -r 96afb248df5e -r 958e69630e52 idavoll/pgsql_storage.py --- a/idavoll/pgsql_storage.py Thu Oct 04 08:03:51 2007 +0000 +++ b/idavoll/pgsql_storage.py Tue Oct 09 10:20:25 2007 +0000 @@ -12,11 +12,14 @@ implements(iidavoll.IStorage) - def __init__(self, user, database, password = None): + def __init__(self, user, database, password=None, host=None, port=None): self._dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL', user=user, password=password, database=database, + host=host, + port=port, + cp_reconnect=True, client_encoding='utf-8' ) diff -r 96afb248df5e -r 958e69630e52 idavoll/tap.py --- a/idavoll/tap.py Thu Oct 04 08:03:51 2007 +0000 +++ b/idavoll/tap.py Tue Oct 09 10:20:25 2007 +0000 @@ -16,14 +16,16 @@ class Options(usage.Options): optParameters = [ - ('jid', None, 'pubsub'), - ('secret', None, 'secret'), - ('rhost', None, '127.0.0.1'), - ('rport', None, '5347'), - ('backend', None, 'memory'), - ('dbuser', None, ''), - ('dbname', None, 'pubsub'), - ('dbpass', None, ''), + ('jid', None, 'pubsub', 'JID this component will be available at'), + ('secret', None, 'secret', 'Jabber server component secret'), + ('rhost', None, '127.0.0.1', 'Jabber server host'), + ('rport', None, '5347', 'Jabber server port'), + ('backend', None, 'memory', 'Choice of storage backend'), + ('dbuser', None, '', 'Database user (pgsql backend)'), + ('dbname', None, 'pubsub', 'Database name (pgsql backend)'), + ('dbpass', None, '', 'Database password (pgsql backend)'), + ('dbhost', None, '', 'Database host (pgsql backend)'), + ('dbport', None, '', 'Database port (pgsql backend)'), ] optFlags = [ @@ -55,7 +57,9 @@ from idavoll.pgsql_storage import Storage st = Storage(user=config['dbuser'], database=config['dbname'], - password=config['dbpass']) + password=config['dbpass'], + host=config['dbhost'], + port=config['dbport']) elif config['backend'] == 'memory': from idavoll.memory_storage import Storage st = Storage()