Use mode property in app and building
This commit is contained in:
parent
488cffc87b
commit
5bf7f0154a
|
|
@ -44,7 +44,7 @@ before_deploy:
|
||||||
export BEFORE_DEPLOY_RUN=1;
|
export BEFORE_DEPLOY_RUN=1;
|
||||||
if [[ $TRAVIS_TAG != "v"* ]]; then exit 1; fi;
|
if [[ $TRAVIS_TAG != "v"* ]]; then exit 1; fi;
|
||||||
export VERSION=$(echo $TRAVIS_TAG | cut -c 2-);
|
export VERSION=$(echo $TRAVIS_TAG | cut -c 2-);
|
||||||
export LD_FLAGS="-X main.Version=${VERSION} -X main.BuildDate=$(date "+%F-%T") -X main.Commit=$(git rev-parse --verify HEAD)";
|
export LD_FLAGS="-X main.Version=${VERSION} -X main.BuildDate=$(date "+%F-%T") -X main.Commit=$(git rev-parse --verify HEAD) -X main.Mode=prod";
|
||||||
go build -ldflags="$LD_FLAGS" -o build/gotify-linux-amd64;
|
go build -ldflags="$LD_FLAGS" -o build/gotify-linux-amd64;
|
||||||
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -ldflags="$LD_FLAGS" -o build/gotify-windows-amd64.exe;
|
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -ldflags="$LD_FLAGS" -o build/gotify-windows-amd64.exe;
|
||||||
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags="$LD_FLAGS" -o build/gotify-linux-arm64;
|
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags="$LD_FLAGS" -o build/gotify-linux-arm64;
|
||||||
|
|
|
||||||
5
app.go
5
app.go
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"github.com/gotify/server/model"
|
"github.com/gotify/server/model"
|
||||||
"github.com/gotify/server/router"
|
"github.com/gotify/server/router"
|
||||||
"github.com/gotify/server/runner"
|
"github.com/gotify/server/runner"
|
||||||
|
"github.com/gotify/server/mode"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -21,10 +22,13 @@ var (
|
||||||
Commit = "unknown"
|
Commit = "unknown"
|
||||||
// BuildDate the date on which this binary was build.
|
// BuildDate the date on which this binary was build.
|
||||||
BuildDate = "unknown"
|
BuildDate = "unknown"
|
||||||
|
// Mode the build mode
|
||||||
|
Mode = mode.Dev
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
vInfo := &model.VersionInfo{Version: Version, Commit: Commit, BuildDate: BuildDate}
|
vInfo := &model.VersionInfo{Version: Version, Commit: Commit, BuildDate: BuildDate}
|
||||||
|
mode.Set(Mode);
|
||||||
|
|
||||||
fmt.Println("Starting Gotify version", vInfo.Version+"@"+BuildDate)
|
fmt.Println("Starting Gotify version", vInfo.Version+"@"+BuildDate)
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
|
@ -35,7 +39,6 @@ func main() {
|
||||||
}
|
}
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
gin.SetMode(gin.ReleaseMode)
|
|
||||||
engine, closeable := router.Create(db, vInfo, conf)
|
engine, closeable := router.Create(db, vInfo, conf)
|
||||||
defer closeable()
|
defer closeable()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue