fix: API version and release are get from config file
parent
0d2e37fd13
commit
1df3f1926c
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"version": "1.1.0",
|
||||
"release": [
|
||||
{
|
||||
"releasetype": "prod",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
)
|
||||
|
||||
type Config struct {
|
||||
Version string
|
||||
Release []ConfigType
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,10 @@ package database
|
|||
|
||||
import (
|
||||
"api/config"
|
||||
"api/globals"
|
||||
"api/models"
|
||||
"api/utils"
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
|
||||
|
|
@ -29,8 +27,6 @@ func ConnectDB() error {
|
|||
return erre
|
||||
}
|
||||
|
||||
globals.API_RELEASE = strings.ToUpper(config.Configurations.ReleaseType)
|
||||
|
||||
driver := config.Configurations.Data.DB_DRIVER
|
||||
user := config.Configurations.Data.DB_USER
|
||||
password := config.Configurations.Data.DB_PASSWORD
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package globals
|
||||
|
||||
var (
|
||||
API_VERSION = "1.1.0"
|
||||
API_VERSION = ""
|
||||
API_RELEASE = ""
|
||||
)
|
||||
|
|
|
|||
9
main.go
9
main.go
|
|
@ -9,7 +9,9 @@ import (
|
|||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||
|
|
@ -41,9 +43,12 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
globals.API_VERSION = config.Conf.Version
|
||||
globals.API_RELEASE = strings.ToUpper(config.Configurations.ReleaseType)
|
||||
|
||||
// Starts process
|
||||
log.Println("Starting API", globals.API_VERSION)
|
||||
log.Println("OS:", os.Getenv("OS"))
|
||||
log.Println("Starting API", globals.API_VERSION+" ("+globals.API_RELEASE+")")
|
||||
log.Println("OS:", runtime.GOOS)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Error opening file: %v", err)
|
||||
|
|
|
|||
Loading…
Reference in New Issue