created API release type (homolog, prod, etc.)
parent
f3a3666294
commit
354011c930
5
.env
5
.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
|
||||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@ package globals
|
|||
|
||||
var (
|
||||
API_VERSION = "1.0.16"
|
||||
API_RELEASE = ""
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue