Read HOST and PORT from .env file
This commit is contained in:
1 parent
e662e3b452
commit
7ff000dc6f
1 file changed
+6
-2
+6
-2
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user