Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e4cf727a6 | ||
|
|
e3af068661 | ||
|
|
3c802467bc | ||
|
|
7ff000dc6f |
@@ -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`
|
||||
- `pip install pywin32 python-dotenv`
|
||||
|
||||
### Go
|
||||
|
||||
@@ -20,9 +20,11 @@ A simple program that integrates with Windows Services to retrieve the hostname
|
||||
|
||||
### Python
|
||||
|
||||
1. Download `hostname-service.py` file
|
||||
2. Open terminal as admin
|
||||
3. `python hostname_service.py run`
|
||||
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`
|
||||
|
||||
### Go
|
||||
|
||||
@@ -56,11 +58,11 @@ Use `python hostname_service.py` and one of the following option names.
|
||||
|
||||
### Go
|
||||
|
||||
Use `./hostname_service.exe` and one of the following option names.
|
||||
Use `go run hostname_service.go` and one of the following option names.
|
||||
|
||||
| Option Name | Description |
|
||||
| :---: | ---: |
|
||||
| | Start the server in standalone mode |
|
||||
| run | Start the server in standalone mode |
|
||||
| install | Create a Windows Service entry |
|
||||
| start | Start the Windows service |
|
||||
| stop | Stop the Windows service |
|
||||
|
||||
+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