1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2025-06-28 07:15:13 +00:00

Comply new package structure

This commit is contained in:
Kristóf Tóth
2019-07-24 15:52:38 +02:00
parent 290c301d27
commit 9095a9f85a
6 changed files with 58 additions and 55 deletions

View File

@ -2,8 +2,8 @@ FROM avatao/controller:debian-buster
USER root
ENV PYTHONPATH="/usr/local/lib" \
TFW_PUBLISHER_PORT=7654 \
TFW_RECEIVER_PORT=8765 \
TFW_PUB_PORT=7654 \
TFW_PULL_PORT=8765 \
TFW_AUTH_KEY="/tmp/tfw-auth.key" \
CONTROLLER_PORT=5555

View File

@ -4,8 +4,8 @@ import json
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler, Application
from tfw.builtins import FSMAwareEventHandler
from tfw.main import EventHandlerFactory
from tfw.event_handlers import FSMAwareEventHandler
from tfw.main import EventHandlerFactory, setup_signal_handlers
class ControllerPostHandler(RequestHandler):
@ -20,23 +20,18 @@ class ControllerPostHandler(RequestHandler):
}))
class ControllerEventHandler(FSMAwareEventHandler):
def handle_event(self, message):
pass
if __name__ == '__main__':
controller = ControllerEventHandler('controller')
controller_eh = EventHandlerFactory().build(controller)
controller_eh = EventHandlerFactory().build(
lambda *_: None,
event_handler_type=FSMAwareEventHandler
)
application = Application([(
f'/{os.environ["SECRET"]}',
ControllerPostHandler,
{'controller': controller}
{'controller': controller_eh}
)])
application.listen(os.environ['CONTROLLER_PORT'])
try:
IOLoop.instance().start()
finally:
controller.cleanup()
setup_signal_handlers()
IOLoop.instance().start()