From c45889237606f379eb850918caa0a1243563854c Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Thu, 2 Apr 2020 12:01:50 +1100 Subject: [PATCH] Added env var for IPADDR --- print.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/print.py b/print.py index 1faf65a..fd142ef 100644 --- a/print.py +++ b/print.py @@ -2,6 +2,7 @@ import socket import json +import os from flask import Flask, render_template CheckPrinterOnline = '7e4d3630312053310d0a' @@ -9,7 +10,10 @@ MachingInfo = "7e4d3131350d0a" GetPrintPercent = "7e4d32370d0a" GetPrinterTemp = "7e4d3130350d0a" -HOST = '10.1.1.83' # The server's hostname or IP address +if os.environ.get('IPADDR') == None: + print("IPADDR environment variable not set please set to printer IP") + SystemExit() +HOST = os.environ.get('IPADDR') # The server's hostname or IP address PORT = 8899 # The port used by the server application = Flask(__name__)