From bee9df24fdd2e7cd783277ecdc0200894b5b028c Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Mon, 24 Jan 2022 08:59:06 +0100 Subject: [PATCH] chg: [server] make port configurable --- bin/server.py | 3 ++- etc/server.conf.sample | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/server.py b/bin/server.py index dc29894..b569fb2 100644 --- a/bin/server.py +++ b/bin/server.py @@ -19,6 +19,7 @@ config = configparser.ConfigParser() config.read('../etc/server.conf') mmdb_file = config['global'].get('mmdb_file') pubsub = config['global'].getboolean('lookup_pubsub') +port = config['global'].getint('port') if pubsub: import redis @@ -85,6 +86,6 @@ app.add_route('/geolookup/{value}', GeoLookup()) app.add_route('/', MyGeoLookup()) if __name__ == '__main__': - with make_server('', 8000, app) as httpd: + with make_server('', port, app) as httpd: print('Serving on port 8000...') httpd.serve_forever() diff --git a/etc/server.conf.sample b/etc/server.conf.sample index eeb6874..8be7e76 100644 --- a/etc/server.conf.sample +++ b/etc/server.conf.sample @@ -1,3 +1,4 @@ [global] mmdb_file = /home/adulau/git/mmdb-server/db/GeoOpen-country.mmd lookup_pubsub = no +port = 8000