~cjwatson/turnip/pastescript

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# You can run this .tac file directly with:
#    twistd -ny packfrontendserver.tac

from __future__ import (
    absolute_import,
    print_function,
    unicode_literals,
    )

from twisted.application import (
    service,
    internet,
    )

from turnip.config import TurnipConfig
from turnip.pack.git import PackFrontendFactory


def getPackFrontendService():
    """Return a PackFrontend Service."""

    config = TurnipConfig()
    return internet.TCPServer(
        config.get('pack_frontend_port'),
        PackFrontendFactory('localhost',
                            config.get('pack_virt_port')))

application = service.Application("Turnip Pack Frontend Service")
service = getPackFrontendService()
service.setServiceParent(application)