Skip to content

Commit 228ab9a

Browse files
authored
Fix formatting and enhance installation instructions
Updated README to fix formatting issues and add details about custom home directory installation.
1 parent 674023a commit 228ab9a

File tree

1 file changed

+57
-4
lines changed

1 file changed

+57
-4
lines changed

README.md

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
![GitHub Stars](https://img.shields.io/github/stars/kumarmuthu/custom-https-server?style=for-the-badge)
1010
![GitHub Contributors](https://img.shields.io/github/contributors/kumarmuthu/custom-https-server?style=for-the-badge)
1111

12-
A lightweight, Python-based **Custom HTTP/HTTPS Server** designed to run as a **Linux systemd service** or a **macOS `launchd` agent**. It is ideal for securely serving static files, logs, test results, build artifacts, or
13-
internal documentation.
12+
A lightweight, Python-based **Custom HTTP/HTTPS Server** designed to run as a **Linux systemd service** or a **macOS `launchd` agent**. It is ideal for securely serving static files, logs, test results, build artifacts, or internal documentation.
1413

1514
This version includes:
1615

1716
* Native **HTTPS support** using a configurable SSL certificate and key
1817
* Optional **HTTP → HTTPS redirection**
1918
* Dynamic configuration loading from `/usr/local/etc/custom-https-server.conf` with local fallback
20-
* Automatic creation and management of log files in the users home directory
19+
* Automatic creation and management of log files in the user's home directory
2120
* OS-specific defaults optimized for **Linux** and **macOS**
2221
* Threaded **HTTP and HTTPS** servers with optional authentication support
2322
* **Read and Write access modes** to control UI and file operations:
@@ -97,6 +96,19 @@ sudo ./install.sh -venv false
9796
sudo ./install.sh -path /root -port 8080
9897
```
9998

99+
### Install with a custom user home directory
100+
101+
Use `-custom_home` when the installer cannot automatically resolve the correct home directory — for example, when
102+
running under `sudo` with a non-standard user or in environments where `$HOME` is overridden.
103+
104+
```bash
105+
sudo ./install.sh -path /root -port 8080 -custom_home /home/myuser
106+
```
107+
108+
* `-custom_home` → Overrides the auto-detected home directory used for log file placement
109+
* If the path provided does not exist, the installer falls back to automatic detection and logs a warning
110+
* Logs will be created under `<custom_home>/custom_https_server_log/logs/`
111+
100112
> 🛡️ **Note:** `sudo` is required for system paths like `/opt` or `/usr/local`.
101113
102114
---
@@ -106,11 +118,13 @@ sudo ./install.sh -path /root -port 8080
106118
Edit the config file:
107119

108120
Linux:
121+
109122
```bash
110123
sudo vi /etc/custom-https-server.conf
111124
```
112125

113126
Mac:
127+
114128
```bash
115129
sudo vi /usr/local/etc/custom-https-server.conf
116130
```
@@ -160,13 +174,19 @@ CFG_ERR_FILE=dynamic_err_file
160174

161175
* `CFG_LOG_*`
162176
→ Resolved dynamically at runtime
163-
→ Logs are auto-created if paths dont exist
177+
→ Logs are auto-created if paths don't exist
164178

165179
> Logs are auto-created if missing (`LOG_DIR`, `LOG_FILE`, `ERR_FILE`) and **stdout/stderr are displayed in terminal**
166180
> when running interactively.
167181
168182
---
169183

184+
Once installed, verify the service is running:
185+
186+
```bash
187+
sudo systemctl status custom-https-server
188+
```
189+
170190
Restart to apply changes:
171191

172192
```bash
@@ -301,6 +321,19 @@ sudo ./install.sh -path /Users/<username> -port 8080
301321
* `-path` → Directory to serve
302322
* `-port` → HTTP/HTTPS port
303323

324+
### Install with a custom user home directory
325+
326+
Use `-custom_home` when the installer cannot resolve the correct home directory — for example, when the macOS user home
327+
is in a non-standard location or `dscl` lookup returns an unexpected path.
328+
329+
```bash
330+
sudo ./install.sh -path /Users/<username> -port 8080 -custom_home /Users/<username>
331+
```
332+
333+
* `-custom_home` → Overrides the auto-detected home directory used for log file placement
334+
* If the path provided does not exist, the installer falls back to automatic detection and logs a warning
335+
* Logs will be created under `<custom_home>/custom_https_server_log/logs/`
336+
304337
The installer automatically sets up a `launchd` agent.
305338

306339
---
@@ -376,6 +409,26 @@ python3 custom_https_server.py \
376409

377410
---
378411

412+
## ⚙️ Installer Arguments Reference
413+
414+
| Argument | Description | Example |
415+
|----------------|---------------------------------------------------------|-----------------------------|
416+
| `-path` | Directory to serve | `-path /var/www` |
417+
| `-port` | HTTP/HTTPS port | `-port 8080` |
418+
| `-mode` | Server mode (`read` or `write`) | `-mode read` |
419+
| `-user` | Auth username | `-user admin` |
420+
| `-pass` | Auth password | `-pass secret` |
421+
| `-venv` | Use virtual environment (`true` or `false`) | `-venv true` |
422+
| `-custom_home` | Override auto-detected home directory for log placement | `-custom_home /home/myuser` |
423+
424+
> **`-custom_home` details:**
425+
> The installer auto-detects the real user's home directory to determine where logs are stored.
426+
> If this detection fails (e.g., non-standard `sudo` environments, unusual `dscl` output on macOS,
427+
> or a custom home directory outside `/home`), supply `-custom_home` to set the path explicitly.
428+
> The provided path must already exist; otherwise the installer falls back to auto-detection with a warning.
429+
430+
---
431+
379432
## ⚙️ Configuration & Port Handling (Important)
380433

381434
> **Important:**

0 commit comments

Comments
 (0)