Mercurial > libervia-pubsub
changeset 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 | bc269696ef42 |
files | idavoll/pgsql_storage.py idavoll/tap.py |
diffstat | 2 files changed, 17 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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' )
--- 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()