blob: cd14f758722e09eca03cdddd8dd992e48a3d8bf7 (
plain)
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
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) 2017, Alice Ferrazzi <alice.ferrazzi@gmail.com>
# Distributed under the terms of the GNU General Public License v2 or later
from flask import Flask
from flask_restful import Api
from elivepatch_server.resources import AgentInfo, dispatcher
def create_app():
"""
Create server application
RESTful api version 1.0
"""
app = Flask(__name__, static_url_path="")
api = Api(app)
api.add_resource(AgentInfo.AgentAPI, '/elivepatch/api/',
endpoint='root')
# get agento information
api.add_resource(AgentInfo.AgentAPI, '/elivepatch/api/v1.0/agent',
endpoint='agent')
# where to retrieve the live patch when ready
api.add_resource(dispatcher.SendLivePatch,
'/elivepatch/api/v1.0/send_livepatch',
endpoint='send_livepatch')
# where to receive the config file
api.add_resource(dispatcher.GetFiles, '/elivepatch/api/v1.0/get_files',
endpoint='config')
return app
if __name__ == '__main__':
app = create_app()
app.run(debug=True, host='0.0.0.0', threaded=True)
|