mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-09 17:53:59 +00:00
cmd/discosrv: Add build stamped version, print at startup
This commit is contained in:
parent
f9e2623fdc
commit
532b4383bf
@ -6,8 +6,11 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/syncthing/syncthing/lib/protocol"
|
"github.com/syncthing/syncthing/lib/protocol"
|
||||||
@ -20,6 +23,24 @@ const (
|
|||||||
maxDeviceAge = 7 * 86400 // one week, in seconds
|
maxDeviceAge = 7 * 86400 // one week, in seconds
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
Version string
|
||||||
|
BuildStamp string
|
||||||
|
BuildUser string
|
||||||
|
BuildHost string
|
||||||
|
|
||||||
|
BuildDate time.Time
|
||||||
|
LongVersion string
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
stamp, _ := strconv.Atoi(BuildStamp)
|
||||||
|
BuildDate = time.Unix(int64(stamp), 0)
|
||||||
|
|
||||||
|
date := BuildDate.UTC().Format("2006-01-02 15:04:05 MST")
|
||||||
|
LongVersion = fmt.Sprintf(`discosrv %s (%s %s-%s) %s@%s %s`, Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildUser, BuildHost, date)
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
lruSize = 10240
|
lruSize = 10240
|
||||||
limitAvg = 5
|
limitAvg = 5
|
||||||
@ -58,6 +79,8 @@ func main() {
|
|||||||
flag.BoolVar(&useHttp, "http", useHttp, "Listen on HTTP (behind an HTTPS proxy)")
|
flag.BoolVar(&useHttp, "http", useHttp, "Listen on HTTP (behind an HTTPS proxy)")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
log.Println(LongVersion)
|
||||||
|
|
||||||
var cert tls.Certificate
|
var cert tls.Certificate
|
||||||
var err error
|
var err error
|
||||||
if !useHttp {
|
if !useHttp {
|
||||||
|
Loading…
Reference in New Issue
Block a user