view idavoll/tap.py @ 163:1701c0e2c707

Add --dbpass option for passing a password to the PostgreSQL backend. Author: edwinm Reviewer: ralphm Fixes #1
author Ralph Meijer <ralphm@ik.nu>
date Thu, 07 Sep 2006 11:13:46 +0000
parents 6250905b72f6
children ef22e4150caa
line wrap: on
line source

# Copyright (c) 2003-2006 Ralph Meijer
# See LICENSE for details.

from twisted.application import internet, service
from twisted.internet import interfaces
from twisted.python import usage
import idavoll

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, ''),
    ]

    optFlags = [
        ('verbose', 'v', 'Show traffic'),
        ('hide-nodes', None, 'Hide all nodes for disco')
    ]
    
    def postOptions(self):
        if self['backend'] not in ['pgsql', 'memory']:
            raise usage.UsageError, "Unknown backend!"

def makeService(config):
    return idavoll.makeService(config)