diff --git a/.env b/.env index 1aea1b7..0428fd3 100644 --- a/.env +++ b/.env @@ -1,11 +1,12 @@ #Used when creating a JWT. It can be anything. API_SECRET=nyEX8BZ44KqTXeV2 API_PORT=8111 +API_RELEASE="Homologação" # DB configuration DB_HOST=177.153.50.98 DB_DRIVER=postgres -DB_USER=pcast +DB_USER=pcasthomolog DB_PASSWORD=@407Smc837 -DB_NAME=pcast +DB_NAME=pcasthomolog DB_PORT=5432 \ No newline at end of file diff --git a/controllers/versionController.go b/controllers/versionController.go index d72bd57..46a99f7 100644 --- a/controllers/versionController.go +++ b/controllers/versionController.go @@ -7,7 +7,9 @@ import ( ) func Version(c *fiber.Ctx) error { - return c.JSON(fiber.Map{ - "version": globals.API_VERSION, - }) + if globals.API_RELEASE == "" { + return c.JSON(globals.API_VERSION) + } else { + return c.JSON(globals.API_VERSION + "-" + globals.API_RELEASE) + } } diff --git a/database/database.go b/database/database.go index 0377200..b9942c4 100644 --- a/database/database.go +++ b/database/database.go @@ -1,6 +1,7 @@ package database import ( + "api/globals" "api/models" "api/utils" "fmt" @@ -27,6 +28,8 @@ func ConnectDB() error { return erre } + globals.API_RELEASE = os.Getenv("API_RELEASE") + // DBURL := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&parseTime=True&loc=Local", os.Getenv("DB_USER"), os.Getenv("DB_PASSWORD"), os.Getenv("DB_HOST"), os.Getenv("DB_PORT"), os.Getenv("DB_NAME")) //DBURL := "postgres://pcast:@407Smc837@177.153.50.98:5432/pcast" DBURL := fmt.Sprintf("%s://%s:%s@%s:%s/%s", os.Getenv("DB_DRIVER"), os.Getenv("DB_USER"), os.Getenv("DB_PASSWORD"), os.Getenv("DB_HOST"), os.Getenv("DB_PORT"), os.Getenv("DB_NAME")) diff --git a/globals/globals.go b/globals/globals.go index 53f9109..d01219e 100644 --- a/globals/globals.go +++ b/globals/globals.go @@ -2,4 +2,5 @@ package globals var ( API_VERSION = "1.0.16" + API_RELEASE = "" )