From ebc51821696f2b68af668a4911ae3ea2dfe52694 Mon Sep 17 00:00:00 2001 From: Jack Stupple Date: Sun, 20 Feb 2022 13:00:55 +0000 Subject: [PATCH] Implement HTTP_PORT environment variable --- minecraft_exporter.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/minecraft_exporter.py b/minecraft_exporter.py index c768ea0..64101da 100644 --- a/minecraft_exporter.py +++ b/minecraft_exporter.py @@ -314,9 +314,15 @@ if __name__ == '__main__': if all(x in os.environ for x in ['RCON_HOST','RCON_PASSWORD']): print("RCON is enabled for "+ os.environ['RCON_HOST']) - start_http_server(8000) + HTTP_PORT = os.environ.get('HTTP_PORT') + if HTTP_PORT == None: + HTTP_PORT = 8000 + + start_http_server(HTTP_PORT) REGISTRY.register(MinecraftCollector()) - print("Exporter started on Port 8000") + + print(f'Exporter started on Port {HTTP_PORT}') + while True: time.sleep(1) schedule.run_pending()