fix: version var in make file

This commit is contained in:
Lakhan Samani 2021-12-24 17:47:35 +05:30
parent 8f826e6c2f
commit 46a91fde20
3 changed files with 5 additions and 4 deletions

View File

@ -2,7 +2,7 @@ DEFAULT_VERSION=0.1.0-local
VERSION := $(or $(VERSION),$(DEFAULT_VERSION))
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:
rm -rf build
test:

3
server/env/env.go vendored
View File

@ -12,7 +12,6 @@ import (
// build variables
var (
VERSION string
ARG_DB_URL *string
ARG_DB_TYPE *string
ARG_AUTHORIZER_URL *string
@ -34,8 +33,6 @@ func InitEnv() {
log.Printf("error loading %s file", constants.ENV_PATH)
}
constants.VERSION = VERSION
if constants.ADMIN_SECRET == "" {
constants.ADMIN_SECRET = os.Getenv("ADMIN_SECRET")
if constants.ADMIN_SECRET == "" {

View File

@ -13,6 +13,8 @@ import (
"github.com/authorizerdev/authorizer/server/utils"
)
var VERSION string
func main() {
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")
@ -20,6 +22,8 @@ func main() {
env.ARG_ENV_FILE = flag.String("env_file", "", "Env file path")
flag.Parse()
constants.VERSION = VERSION
env.InitEnv()
db.InitDB()
session.InitSession()