Fix version not being set at build, close #386

This commit is contained in:
tidwall 2018-11-15 13:45:36 -07:00
parent c2ebffabd4
commit 737561fa8b
4 changed files with 10 additions and 10 deletions

View File

@ -8,13 +8,13 @@ VERSION=1.14.1
PROTECTED_MODE="no"
# Hardcode some values to the core package
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/pkg/core.Version=${VERSION}"
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.Version=${VERSION}"
if [ -d ".git" ]; then
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/pkg/core.GitSHA=$(git rev-parse --short HEAD)"
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.GitSHA=$(git rev-parse --short HEAD)"
fi
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/pkg/core.BuildTime=$(date +%FT%T%z)"
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.BuildTime=$(date +%FT%T%z)"
if [ "$PROTECTED_MODE" == "no" ]; then
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/pkg/core.ProtectedMode=no"
LDFLAGS="$LDFLAGS -X github.com/tidwall/tile38/core.ProtectedMode=no"
fi
if [ "$1" == "update-version" ]; then

View File

@ -147,10 +147,10 @@ Developer Options:
if i < len(os.Args) {
switch strings.ToLower(os.Args[i]) {
case "no":
core.ProtectedMode = false
core.ProtectedMode = "no"
continue
case "yes":
core.ProtectedMode = true
core.ProtectedMode = "yes"
continue
}
}

View File

@ -7,16 +7,16 @@ var DevMode = false
var ShowDebugMessages = false
// ProtectedMode forces Tile38 to default in protected mode.
var ProtectedMode = true
var ProtectedMode = "no"
// AppendOnly allows for disabling the appendonly file.
var AppendOnly = true
// AppendFileName allows for custom appendonly file path
var AppendFileName string
var AppendFileName = ""
// QueueFileName allows for custom queue.db file path
var QueueFileName string
var QueueFileName = ""
// NumThreads is the number of network threads to use.
var NumThreads int

View File

@ -278,7 +278,7 @@ func Serve(host string, port int, dir string, http bool) error {
}
func (server *Server) isProtected() bool {
if core.ProtectedMode == false {
if core.ProtectedMode == "no" {
// --protected-mode no
return false
}