forked from clp-research/slurk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chat.py
executable file
·31 lines (24 loc) · 942 Bytes
/
chat.py
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
31
#!/bin/env python
from gevent import monkey
monkey.patch_all(subprocess=True)
import configparser
from app import create_app, socketio
app = create_app()
config = configparser.ConfigParser()
config.read("config.ini")
if __name__ == '__main__':
if config['ssl']['enabled'] == 'yes':
import ssl
from wsgiserver import WSGIServer
ctx = ssl.SSLContext(protocol=ssl.PROTOCOL_TLSv1_2)
ctx.load_cert_chain(config['ssl']['certificate'], config['ssl']['key'])
http_server = WSGIServer(
(config['server']['host'], config['server']['port']),
app,
certfile=config['ssl']['certificate'],
keyfile=config['ssl']['key']
)
http_server.serve_forever()
socketio.run(app, config['server']['host'], int(config['server']['port']), ssl_context=ctx)
else:
socketio.run(app, config['server']['host'], int(config['server']['port']))