mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
Print githash and build time at startup
This commit is contained in:
parent
32a4f34c7c
commit
4983437a34
3 changed files with 34 additions and 9 deletions
5
Makefile
5
Makefile
|
|
@ -4,7 +4,9 @@ ifeq ($(OS),Windows_NT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build:
|
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:
|
install:
|
||||||
packr2 install
|
packr2 install
|
||||||
|
|
@ -35,3 +37,4 @@ lint:
|
||||||
.PHONY: ui
|
.PHONY: ui
|
||||||
ui:
|
ui:
|
||||||
cd ui/v2 && yarn build
|
cd ui/v2 && yarn build
|
||||||
|
packr2
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,15 @@ import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime/debug"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/99designs/gqlgen/handler"
|
"github.com/99designs/gqlgen/handler"
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
"github.com/go-chi/chi/middleware"
|
"github.com/go-chi/chi/middleware"
|
||||||
|
|
@ -16,16 +25,11 @@ import (
|
||||||
"github.com/stashapp/stash/pkg/manager/paths"
|
"github.com/stashapp/stash/pkg/manager/paths"
|
||||||
"github.com/stashapp/stash/pkg/models"
|
"github.com/stashapp/stash/pkg/models"
|
||||||
"github.com/stashapp/stash/pkg/utils"
|
"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 uiBox *packr.Box
|
||||||
|
|
||||||
//var legacyUiBox *packr.Box
|
//var legacyUiBox *packr.Box
|
||||||
|
|
@ -154,6 +158,7 @@ func Start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
printVersion()
|
||||||
logger.Infof("stash is running on HTTPS at https://" + address + "/")
|
logger.Infof("stash is running on HTTPS at https://" + address + "/")
|
||||||
logger.Fatal(httpsServer.ListenAndServeTLS("", ""))
|
logger.Fatal(httpsServer.ListenAndServeTLS("", ""))
|
||||||
}()
|
}()
|
||||||
|
|
@ -164,12 +169,17 @@ func Start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
printVersion()
|
||||||
logger.Infof("stash is running on HTTP at http://" + address + "/")
|
logger.Infof("stash is running on HTTP at http://" + address + "/")
|
||||||
logger.Fatal(server.ListenAndServe())
|
logger.Fatal(server.ListenAndServe())
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func printVersion() {
|
||||||
|
fmt.Printf("stash version: %s (%s)\n", githash, buildstamp)
|
||||||
|
}
|
||||||
|
|
||||||
func makeTLSConfig() *tls.Config {
|
func makeTLSConfig() *tls.Config {
|
||||||
cert, err := ioutil.ReadFile(paths.GetSSLCert())
|
cert, err := ioutil.ReadFile(paths.GetSSLCert())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
12
scripts/getDate.go
Normal file
12
scripts/getDate.go
Normal file
|
|
@ -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 a new issue