mirror of https://github.com/stashapp/stash.git
Print githash and build time at startup
This commit is contained in:
parent
32a4f34c7c
commit
4983437a34
5
Makefile
5
Makefile
|
@ -4,7 +4,9 @@ ifeq ($(OS),Windows_NT)
|
|||
endif
|
||||
|
||||
build:
|
||||
$(SET) CGO_ENABLED=1 $(SEPARATOR) packr2 build -mod=vendor -v
|
||||
$(eval DATE := $(shell go run scripts/getDate.go))
|
||||
$(eval GITHASH := $(shell git rev-parse HEAD))
|
||||
$(SET) CGO_ENABLED=1 $(SEPARATOR) go build -mod=vendor -v -ldflags "-X 'github.com/stashapp/stash/pkg/api.buildstamp=$(DATE)' -X 'github.com/stashapp/stash/pkg/api.githash=$(GITHASH)'"
|
||||
|
||||
install:
|
||||
packr2 install
|
||||
|
@ -35,3 +37,4 @@ lint:
|
|||
.PHONY: ui
|
||||
ui:
|
||||
cd ui/v2 && yarn build
|
||||
packr2
|
||||
|
|
|
@ -5,6 +5,15 @@ import (
|
|||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/99designs/gqlgen/handler"
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/go-chi/chi/middleware"
|
||||
|
@ -16,16 +25,11 @@ import (
|
|||
"github.com/stashapp/stash/pkg/manager/paths"
|
||||
"github.com/stashapp/stash/pkg/models"
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var buildstamp string = ""
|
||||
var githash string = ""
|
||||
|
||||
var uiBox *packr.Box
|
||||
|
||||
//var legacyUiBox *packr.Box
|
||||
|
@ -154,6 +158,7 @@ func Start() {
|
|||
}
|
||||
|
||||
go func() {
|
||||
printVersion()
|
||||
logger.Infof("stash is running on HTTPS at https://" + address + "/")
|
||||
logger.Fatal(httpsServer.ListenAndServeTLS("", ""))
|
||||
}()
|
||||
|
@ -164,12 +169,17 @@ func Start() {
|
|||
}
|
||||
|
||||
go func() {
|
||||
printVersion()
|
||||
logger.Infof("stash is running on HTTP at http://" + address + "/")
|
||||
logger.Fatal(server.ListenAndServe())
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
func printVersion() {
|
||||
fmt.Printf("stash version: %s (%s)\n", githash, buildstamp)
|
||||
}
|
||||
|
||||
func makeTLSConfig() *tls.Config {
|
||||
cert, err := ioutil.ReadFile(paths.GetSSLCert())
|
||||
if err != nil {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
import "time"
|
||||
|
||||
func main() {
|
||||
now := time.Now().Format("2006-01-02 15:04:05")
|
||||
|
||||
fmt.Printf("%s", now)
|
||||
}
|
Loading…
Reference in New Issue