mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-15 06:42:26 +03:00
Merge pull request #97 from Athanasius/bottle-app
Switch bottle to using an 'app' instance.
This commit is contained in:
commit
754e74c7c3
@ -21,7 +21,8 @@ from eddn.core.Validator import Validator, ValidationSeverity
|
|||||||
|
|
||||||
from gevent import monkey
|
from gevent import monkey
|
||||||
monkey.patch_all()
|
monkey.patch_all()
|
||||||
from bottle import run, request, response, get, post
|
from bottle import Bottle, run, request, response, get, post
|
||||||
|
app = Bottle()
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -158,7 +159,7 @@ def parse_and_error_handle(data):
|
|||||||
return "FAIL: " + str(validationResults.messages)
|
return "FAIL: " + str(validationResults.messages)
|
||||||
|
|
||||||
|
|
||||||
@post('/upload/')
|
@app.post('/upload/')
|
||||||
def upload():
|
def upload():
|
||||||
response.set_header("Access-Control-Allow-Origin", "*")
|
response.set_header("Access-Control-Allow-Origin", "*")
|
||||||
try:
|
try:
|
||||||
@ -181,7 +182,7 @@ def upload():
|
|||||||
return parse_and_error_handle(message_body)
|
return parse_and_error_handle(message_body)
|
||||||
|
|
||||||
|
|
||||||
@get('/health_check/')
|
@app.get('/health_check/')
|
||||||
def health_check():
|
def health_check():
|
||||||
"""
|
"""
|
||||||
This should only be used by the gateway monitoring script. It is used
|
This should only be used by the gateway monitoring script. It is used
|
||||||
@ -191,7 +192,7 @@ def health_check():
|
|||||||
return Settings.EDDN_VERSION
|
return Settings.EDDN_VERSION
|
||||||
|
|
||||||
|
|
||||||
@get('/stats/')
|
@app.get('/stats/')
|
||||||
def stats():
|
def stats():
|
||||||
response.set_header("Access-Control-Allow-Origin", "*")
|
response.set_header("Access-Control-Allow-Origin", "*")
|
||||||
stats = statsCollector.getSummary()
|
stats = statsCollector.getSummary()
|
||||||
@ -211,7 +212,7 @@ class MalformedUploadError(Exception):
|
|||||||
def main():
|
def main():
|
||||||
loadConfig()
|
loadConfig()
|
||||||
configure()
|
configure()
|
||||||
run(
|
app.run(
|
||||||
host=Settings.GATEWAY_HTTP_BIND_ADDRESS,
|
host=Settings.GATEWAY_HTTP_BIND_ADDRESS,
|
||||||
port=Settings.GATEWAY_HTTP_PORT,
|
port=Settings.GATEWAY_HTTP_PORT,
|
||||||
server='gevent',
|
server='gevent',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user