1 Commits
Author SHA1 Message Date
iamdoubz f3c4681e49 Merge pull request 'Add go files' (#1) from dev into main
Reviewed-on: #1
2025-05-21 13:04:57 -05:00
3 changed files with 8 additions and 16 deletions
+6 -8
View File
@@ -8,7 +8,7 @@ A simple program that integrates with Windows Services to retrieve the hostname
- At least python3.10 or higher (may work on lower versions but untested)
- python and pip are in your environmental variables (python --version)
- `pip install pywin32 python-dotenv`
- `pip install pywin32`
### Go
@@ -20,11 +20,9 @@ A simple program that integrates with Windows Services to retrieve the hostname
### Python
1. Download `hostname-service.py` and `env.txt` files
2. Copy `env.txt` to `.env`
3. Edit `.env` file to match your requirements
4. Open terminal as admin
5. `python hostname_service.py run`
1. Download `hostname-service.py` file
2. Open terminal as admin
3. `python hostname_service.py run`
### Go
@@ -58,11 +56,11 @@ Use `python hostname_service.py` and one of the following option names.
### Go
Use `go run hostname_service.go` and one of the following option names.
Use `./hostname_service.exe` and one of the following option names.
| Option Name | Description |
| :---: | ---: |
| run | Start the server in standalone mode |
| | Start the server in standalone mode |
| install | Create a Windows Service entry |
| start | Start the Windows service |
| stop | Stop the Windows service |
-2
View File
@@ -1,2 +0,0 @@
HOST=127.0.0.1
PORT=8999
+2 -6
View File
@@ -1,5 +1,4 @@
from http.server import BaseHTTPRequestHandler, HTTPServer
from dotenv import load_dotenv
import socket
import json
import threading
@@ -11,11 +10,8 @@ import servicemanager
import os
import sys
# Load environment variables from .env file
load_dotenv()
HOST = os.getenv("HOST", "0.0.0.0")
PORT = int(os.getenv("PORT", 8999))
HOST = '0.0.0.0'
PORT = 8999
LOG_FILE = os.path.join(os.path.dirname(__file__), 'hostname_service.log')
logging.basicConfig(