fix: version var in make file
This commit is contained in:
parent
8f826e6c2f
commit
46a91fde20
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@ DEFAULT_VERSION=0.1.0-local
|
||||||
VERSION := $(or $(VERSION),$(DEFAULT_VERSION))
|
VERSION := $(or $(VERSION),$(DEFAULT_VERSION))
|
||||||
|
|
||||||
cmd:
|
cmd:
|
||||||
cd server && go build -ldflags "-w -X main.Version=$(VERSION)" -o '../build/server'
|
cd server && go build -ldflags "-w -X main.VERSION=$(VERSION)" -o '../build/server'
|
||||||
clean:
|
clean:
|
||||||
rm -rf build
|
rm -rf build
|
||||||
test:
|
test:
|
||||||
|
|
3
server/env/env.go
vendored
3
server/env/env.go
vendored
|
@ -12,7 +12,6 @@ import (
|
||||||
|
|
||||||
// build variables
|
// build variables
|
||||||
var (
|
var (
|
||||||
VERSION string
|
|
||||||
ARG_DB_URL *string
|
ARG_DB_URL *string
|
||||||
ARG_DB_TYPE *string
|
ARG_DB_TYPE *string
|
||||||
ARG_AUTHORIZER_URL *string
|
ARG_AUTHORIZER_URL *string
|
||||||
|
@ -34,8 +33,6 @@ func InitEnv() {
|
||||||
log.Printf("error loading %s file", constants.ENV_PATH)
|
log.Printf("error loading %s file", constants.ENV_PATH)
|
||||||
}
|
}
|
||||||
|
|
||||||
constants.VERSION = VERSION
|
|
||||||
|
|
||||||
if constants.ADMIN_SECRET == "" {
|
if constants.ADMIN_SECRET == "" {
|
||||||
constants.ADMIN_SECRET = os.Getenv("ADMIN_SECRET")
|
constants.ADMIN_SECRET = os.Getenv("ADMIN_SECRET")
|
||||||
if constants.ADMIN_SECRET == "" {
|
if constants.ADMIN_SECRET == "" {
|
||||||
|
|
|
@ -13,6 +13,8 @@ import (
|
||||||
"github.com/authorizerdev/authorizer/server/utils"
|
"github.com/authorizerdev/authorizer/server/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var VERSION string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
env.ARG_DB_URL = flag.String("database_url", "", "Database connection string")
|
env.ARG_DB_URL = flag.String("database_url", "", "Database connection string")
|
||||||
env.ARG_DB_TYPE = flag.String("database_type", "", "Database type, possible values are postgres,mysql,sqlite")
|
env.ARG_DB_TYPE = flag.String("database_type", "", "Database type, possible values are postgres,mysql,sqlite")
|
||||||
|
@ -20,6 +22,8 @@ func main() {
|
||||||
env.ARG_ENV_FILE = flag.String("env_file", "", "Env file path")
|
env.ARG_ENV_FILE = flag.String("env_file", "", "Env file path")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
constants.VERSION = VERSION
|
||||||
|
|
||||||
env.InitEnv()
|
env.InitEnv()
|
||||||
db.InitDB()
|
db.InitDB()
|
||||||
session.InitSession()
|
session.InitSession()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user