chg: [server] make port configurable

This commit is contained in:
Alexandre Dulaunoy 2022-01-24 08:59:06 +01:00
parent eb37aa0cc9
commit bee9df24fd
Signed by: adulau
GPG key ID: 09E2CD4944E6CBCD
2 changed files with 3 additions and 1 deletions

View file

@ -19,6 +19,7 @@ config = configparser.ConfigParser()
config.read('../etc/server.conf') config.read('../etc/server.conf')
mmdb_file = config['global'].get('mmdb_file') mmdb_file = config['global'].get('mmdb_file')
pubsub = config['global'].getboolean('lookup_pubsub') pubsub = config['global'].getboolean('lookup_pubsub')
port = config['global'].getint('port')
if pubsub: if pubsub:
import redis import redis
@ -85,6 +86,6 @@ app.add_route('/geolookup/{value}', GeoLookup())
app.add_route('/', MyGeoLookup()) app.add_route('/', MyGeoLookup())
if __name__ == '__main__': if __name__ == '__main__':
with make_server('', 8000, app) as httpd: with make_server('', port, app) as httpd:
print('Serving on port 8000...') print('Serving on port 8000...')
httpd.serve_forever() httpd.serve_forever()

View file

@ -1,3 +1,4 @@
[global] [global]
mmdb_file = /home/adulau/git/mmdb-server/db/GeoOpen-country.mmd mmdb_file = /home/adulau/git/mmdb-server/db/GeoOpen-country.mmd
lookup_pubsub = no lookup_pubsub = no
port = 8000