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(