def main(): logging.basicConfig(level=logging.DEBUG) di = DependencyInjector() di['redis'] = Redis() di['jinja'] = jinja2.Environment( loader=jinja2.PackageLoader(__name__, 'templates')) note = zmq.rep_socket(di.inject(notepads.NotepadHTTP('uri'))) note.connect('ipc://./run/notepad.sock') dash = zmq.rep_socket(di.inject(dashboards.DashboardHTTP('uri'))) dash.connect('ipc://./run/dashboard.sock') outsock = zmq.pub_socket() outsock.connect('ipc://./run/ws-output.sock') output = di.inject(JSONWebsockOutput(outsock)) di['websock_output'] = output wsdef = zmq.pull_socket(di.inject(DefaultHandler())) wsdef.connect('ipc://./run/ws-default.sock') wsnote = zmq.pull_socket( di.inject(notepads.NotepadWebsock(prefix='notepad.'), output='websock_output')) wsnote.connect('ipc://./run/ws-notepad.sock') wsdash = zmq.pull_socket( di.inject(dashboards.DashboardWebsock(prefix='dashboard.'), output='websock_output')) wsdash.connect('ipc://./run/ws-dashboard.sock')
def main(): logging.basicConfig(level=logging.DEBUG) di = DependencyInjector() di['redis'] = Redis() di['jinja'] = jinja2.Environment( loader=jinja2.PackageLoader(__name__, 'templates')) note = zmq.rep_socket( di.inject(notepads.NotepadHTTP('uri'))) note.connect('ipc://./run/notepad.sock') dash = zmq.rep_socket( di.inject(dashboards.DashboardHTTP('uri'))) dash.connect('ipc://./run/dashboard.sock') outsock = zmq.pub_socket() outsock.connect('ipc://./run/ws-output.sock') output = di.inject(JSONWebsockOutput(outsock)) di['websock_output'] = output wsdef = zmq.pull_socket( di.inject(DefaultHandler())) wsdef.connect('ipc://./run/ws-default.sock') wsnote = zmq.pull_socket( di.inject(notepads.NotepadWebsock(prefix='notepad.'), output='websock_output')) wsnote.connect('ipc://./run/ws-notepad.sock') wsdash = zmq.pull_socket( di.inject(dashboards.DashboardWebsock(prefix='dashboard.'), output='websock_output')) wsdash.connect('ipc://./run/ws-dashboard.sock')
def main(): ap = argparse.ArgumentParser() ap.add_argument('-s', '--sockdir', default='./run') ap.add_argument('-r', '--redis', default='run/redis') options = ap.parse_args() inj = DependencyInjector() inj['jinja'] = jinja2.Environment( loader=jinja2.PackageLoader(__name__, 'templates')) inj['redis'] = redis.Redis( unixsock=options.redis + '/redis.sock') sock = zmq.pub_socket() sock.dict_configure({'connect': 'ipc://' + options.sockdir + '/sub.sock'}) output = zerogw.JSONWebsockOutput(sock) inj['output'] = output sock = zmq.pull_socket(inj.inject(web.Websockets( resources=[], output=output, ))) sock.dict_configure({'connect': 'ipc://' + options.sockdir + '/fw.sock'}) site = web.Site( request_class=Request, resources=[ inj.inject(About()), inj.inject(Register()), inj.inject(ShowIssue()), ]) sock = zmq.rep_socket(site) sock.dict_configure({ 'connect': 'ipc://' + options.sockdir + '/http.sock' })
def main(): inj = DependencyInjector() inj['jinja'] = jinja2.Environment( loader=jinja2.FileSystemLoader('./templates')) inj['redis'] = redis.Redis(host='127.0.0.1', port=6379) site = web.Site( request_class=Request, resources=[ inj.inject(About()), inj.inject(Auth()), ]) sock = zmq.rep_socket(site) sock.dict_configure({'connect': 'ipc://./run/http.sock'}) sock = zmq.pub_socket() sock.dict_configure({'connect': 'ipc://./run/sub.sock'}) output = zerogw.JSONWebsockOutput(sock) inj['output'] = output sock = zmq.pull_socket(inj.inject(Websockets( resources=[web.DictResource({ 'pager': inj.inject(Pager()), 'auth': inj.inject(WebsockAuth()), })], output=output, ))) sock.dict_configure({'connect': 'ipc://./run/fw.sock'})