diff --git a/bin/server.py b/bin/server.py index 301fac1..d256c6a 100644 --- a/bin/server.py +++ b/bin/server.py @@ -7,6 +7,9 @@ import falcon from wsgiref.simple_server import make_server import json +# Configuration +port = 8000 + runPath = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(runPath, "..")) from lib.cpeguesser import CPEGuesser @@ -36,6 +39,12 @@ if __name__ == '__main__': app = falcon.App() app.add_route('/search', Search()) - with make_server('', 8000, app) as httpd: - print('Serving on port 8000...') - httpd.serve_forever() + try: + with make_server('', port, app) as httpd: + print(f"Serving on port {port}...") + httpd.serve_forever() + except OSError as e: + print (e) + sys.exit(1) + except KeyboardInterrupt: + sys.exit(0)