From 7ff000dc6f4c7396cb90e46453e8699faa78b8ff Mon Sep 17 00:00:00 2001 From: iamdoubz <> Date: Wed, 21 May 2025 13:51:41 -0500 Subject: [PATCH] Read HOST and PORT from .env file --- hostname_service.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hostname_service.py b/hostname_service.py index e6e54c5..86757c8 100644 --- a/hostname_service.py +++ b/hostname_service.py @@ -1,4 +1,5 @@ from http.server import BaseHTTPRequestHandler, HTTPServer +from dotenv import load_dotenv import socket import json import threading @@ -10,8 +11,11 @@ import servicemanager import os import sys -HOST = '0.0.0.0' -PORT = 8999 +# Load environment variables from .env file +load_dotenv() + +HOST = os.getenv("HOST", "0.0.0.0") +PORT = int(os.getenv("PORT", 8999)) LOG_FILE = os.path.join(os.path.dirname(__file__), 'hostname_service.log') logging.basicConfig(