@@ -186,6 +186,7 @@ Grouped by concern for readability. All flags are optional; unset flags do not o
186186| ------| ------| ---------| --------------|
187187| ` --host ` | string | `` (all interfaces) | ` server.addr ` (host part) |
188188| ` --port ` , ` -p ` | int | ` 8080 ` | ` server.addr ` (port part) |
189+ | ` --redirect-host ` | string | — | ` server.redirect_host ` |
189190| ` --tls-cert ` | string | — | ` server.tls_cert ` |
190191| ` --tls-key ` | string | — | ` server.tls_key ` |
191192| ` --tls-port ` | int | ` 8443 ` | ` server.tls_addr ` (port part) |
@@ -205,6 +206,8 @@ Grouped by concern for readability. All flags are optional; unset flags do not o
205206| ------| ------| ---------| --------------|
206207| ` --no-cache ` | bool | ` false ` | ` cache.enabled = false ` |
207208| ` --cache-size ` | string | ` 256MB ` | ` cache.max_bytes ` (parses ` 256MB ` , ` 64MB ` , ` 1GB ` ) |
209+ | ` --preload ` | bool | ` false ` | ` cache.preload ` — load all files into cache at startup |
210+ | ` --gc-percent ` | int | ` 0 ` | ` cache.gc_percent ` — Go GC target % (0 = default; try 400 for throughput) |
208211
209212#### Compression
210213
@@ -244,6 +247,7 @@ static-web --dir-listing --no-dotfile-block ~/Downloads
244247
245248# Serve with TLS (HTTPS on :443, HTTP redirect on :80)
246249static-web --port 80 --tls-port 443 \
250+ --redirect-host static.example.com \
247251 --tls-cert /etc/ssl/cert.pem \
248252 --tls-key /etc/ssl/key.pem \
249253 ./public
@@ -265,6 +269,9 @@ static-web
265269# Disable caching (useful during local development to see file changes immediately)
266270static-web --no-cache ./dist
267271
272+ # Maximum throughput: preload all files + tune GC
273+ static-web --preload --gc-percent 400 ./dist
274+
268275# Print version info
269276static-web version
270277```
@@ -385,7 +392,7 @@ The CLI was implemented using Go stdlib `flag.FlagSet` — no external framework
385392- ** ` --host ` + ` --port ` merging** : ` net.SplitHostPort ` / ` net.JoinHostPort ` used to decompose and reconstruct ` server.addr ` .
386393- ** ` parseBytes() ` ** : a small helper that parses ` 256MB ` , ` 1GB ` , etc. with ` B ` /` KB ` /` MB ` /` GB ` suffixes (case-insensitive).
387394- ** ` //go:embed config.toml.example ` ** : the example config is embedded in ` cmd/static-web/ ` at compile time. The binary is fully self-contained.
388- - ** ` --quiet ` ** : passes ` io.Discard ` to a ` loggingMiddlewareWithWriter ` variant, suppressing access log output with zero overhead.
395+ - ** ` --quiet ` ** : skips access-log middleware entirely, removing per-request logging overhead.
389396- ** ` --verbose ` ** : calls ` logConfig(cfg) ` after all overrides are applied, so you see the final resolved values.
390397- ** Version injection** : ` internal/version.Version ` , ` Commit ` , ` Date ` are set via ` -ldflags ` at build time. Default to ` "dev" ` , ` "none" ` , ` "unknown" ` for ` go run ` .
391398
0 commit comments