You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add /version endpoint and --version CLI flag (#248)
In order not to suddenly reveal _potentially_ sensitive information
without users explicitly opting in, the `/version` endpoint will only
name the service:
{
"service": "go-httpbin"
}
But with `--use-full-version`/`USE_FULL_VERSION=true` set, it exposes
more detailed info:
{
"service": "go-httpbin",
"version": "2.22.0-next",
"commit": "6c58644",
"build_date": "2026-04-11T15:50:03Z",
"go_version": "go1.26.1"
}
Closes#191, #190, and #188.
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,7 +115,9 @@ variables (or a combination of the two):
115
115
|`-srv-max-header-bytes`|`SRV_MAX_HEADER_BYTES`| Value to use for the http.Server's MaxHeaderBytes option | 16384 |
116
116
|`-srv-read-header-timeout`|`SRV_READ_HEADER_TIMEOUT`| Value to use for the http.Server's ReadHeaderTimeout option | 1s |
117
117
|`-srv-read-timeout`|`SRV_READ_TIMEOUT`| Value to use for the http.Server's ReadTimeout option | 5s |
118
+
|`-use-full-version`|`USE_FULL_VERSION`| Expose full version details (release, commit, build date, Go runtime) via the /version endpoint (default: service name only) | false |
118
119
|`-use-real-hostname`|`USE_REAL_HOSTNAME`| Expose real hostname as reported by os.Hostname() in the /hostname endpoint | false |
120
+
|`-version`|| Print version and exit ||
119
121
120
122
> [!WARNING]
121
123
> These configuration options are dangerous and/or deprecated and should be
// Here be dragons! This flag is only for backwards compatibility and
186
209
// should not be used in production.
187
210
fs.BoolVar(&cfg.UnsafeAllowDangerousResponses, "unsafe-allow-dangerous-responses", false, "Allow endpoints to return unescaped HTML when clients control response Content-Type (enables XSS attacks)")
211
+
fs.BoolVar(&cfg.UseFullVersion, "use-full-version", false, "Expose full version details via /version (default: service name only)")
188
212
189
213
// in order to fully control error output whether CLI arguments or env vars
190
214
// are used to configure the app, we need to take control away from the
0 commit comments