-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.py
45 lines (38 loc) · 1.75 KB
/
service.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import logging
import tornado.web
from tornado.web import URLSpec
from tornado.ioloop import IOLoop
from handler import PostHandler, RewriteHandler, QueryHandler, QueryComponentHandler, \
SchemaHandler, CreateHandler, EncryptSqlHandler, PostHandler_jar, EncryptSqlHandler1, EncryptSqlHandler2, DecryptResult
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
HANDLERS = [
URLSpec(r'/query', PostHandler,
name=PostHandler.__name__),
URLSpec(r'/query_jar', PostHandler_jar,
name=PostHandler_jar.__name__),
URLSpec(r'/rewrite_query', RewriteHandler,
name=RewriteHandler.__name__),
URLSpec(r'/jdbc_query', QueryHandler,
name=QueryHandler.__name__),
URLSpec(r'/create_table', CreateHandler,
name=CreateHandler.__name__),
URLSpec(r'/jdbc_query/component/?([?P<component_id>\w])?', QueryComponentHandler,
name=QueryComponentHandler.__name__),
URLSpec(r'/jdbc_query/schema/?([?P<component_id>\w])?', SchemaHandler,
name=SchemaHandler.__name__),
URLSpec(r'/encrypt_sql', EncryptSqlHandler,
name=SchemaHandler.__name__),
URLSpec(r'/encrypt_sql1', EncryptSqlHandler1,
name=SchemaHandler.__name__),
URLSpec(r'/encrypt_sql2', EncryptSqlHandler2,
name=SchemaHandler.__name__),
URLSpec(r'/decrypt_data', DecryptResult,
name=SchemaHandler.__name__),
]
if __name__ == '__main__':
SERVER_PORT = 8888
app = tornado.web.Application(handlers=HANDLERS, debug=True)
app.listen(SERVER_PORT)
logger.info("Clean Panel server started on port {SERVER_PORT}".format(SERVER_PORT=SERVER_PORT))
IOLoop.current().start()