@@ -22,6 +22,8 @@ import (
22
22
"go.uber.org/zap"
23
23
)
24
24
25
+ var GitCommit string
26
+
25
27
var (
26
28
flagAddr = flag .String ("addr" , ":8080" , "Server address" )
27
29
flagPatchCache = flag .String ("patchcache" , "." , "Path to the patch cache" )
32
34
flagCertFile = flag .String ("certfile" , "" , "Path to a TLS cert file" )
33
35
flagKeyFile = flag .String ("keyfile" , "" , "Path to a TLS key file" )
34
36
flagDebug = flag .Bool ("debug" , false , "Enable debug logging (otherwise production level log)" )
37
+ flagVersion = flag .Bool ("version" , false , "Print version and exit" )
35
38
)
36
39
37
40
const tarballURLBase = "https://www.linbit.com/downloads/drbd/"
@@ -60,6 +63,11 @@ type server struct {
60
63
func main () {
61
64
flag .Parse ()
62
65
66
+ if * flagVersion {
67
+ fmt .Printf ("Git-commit: '%s'\n " , GitCommit )
68
+ os .Exit (0 )
69
+ }
70
+
63
71
if * flagMaxBytesBody < 0 {
64
72
log .Fatal ("maxbytesbody has to be a positive value" )
65
73
}
@@ -370,6 +378,16 @@ func (s *server) genPatch(r *http.Request, drbdversion string) ([]byte, error) {
370
378
return patch , nil
371
379
}
372
380
381
+ func (s * server ) hello () http.HandlerFunc {
382
+ return func (w http.ResponseWriter , r * http.Request ) {
383
+ w .Header ().Set ("Content-Type" , "application/text" )
384
+
385
+ if _ , err := fmt .Fprintf (w , "Successfully connected to SPAAS ('%s')\n " , GitCommit ); err != nil {
386
+ w .WriteHeader (http .StatusInternalServerError )
387
+ }
388
+ }
389
+ }
390
+
373
391
func (s * server ) errorf (code int , remoteAddr string , w http.ResponseWriter , format string , a ... interface {}) {
374
392
w .WriteHeader (code )
375
393
_ , _ = fmt .Fprintf (w , format , a ... )
0 commit comments