view sat_pubsub.tac @ 369:dabee42494ac

config file + cleaning: - SàT Pubsub can now be configured using the same config file as SàT itself (i.e. sat.conf or .sat.conf), in the same locations (/etc, local dir, xdg dir). Its options must be in the "pubsub" section - options on command line override config options - removed tap and http files which are not used anymore - changed directory structure to put source in src, to be coherent with SàT and Libervia - changed options name, db* become db_*, secret become xmpp_pwd - an exception is raised if jid or xmpp_pwd is are not configured
author Goffi <goffi@goffi.org>
date Fri, 02 Mar 2018 12:59:38 +0100
parents 51af2ed8bd50
children
line wrap: on
line source

#!/usr/bin/python
#-*- coding: utf-8 -*-
# Copyright (c) 2003-2008 Ralph Meijer
# See LICENSE for details.

"""
Example TAC for SàT Pubsub.
"""

from twisted.application import service
from twisted.words.protocols.jabber.jid import JID

from sat_pubsub import tap

application = service.Application("sat_pubsub")

config = {
    'jid': JID('sat-pubsub.necton3.int'),
    'secret': 'pass',
    'rhost': '127.0.0.1',
    'rport': 5347,
    'backend': 'pgsql',
    'dbuser': 'goffi',
    'dbpass': 'toto',
    'dbname': "pubsub",
    'dbhost': "localhost",
    'dbport': None,
    'verbose': True,
    'hide-nodes': False,
}

idavollService = tap.makeService(config)
idavollService.setServiceParent(application)

# Set the maximum delay until trying to reconnect.
componentService = idavollService.getServiceNamed('component')
componentService.factory.maxdelay = 300