Skip to content

Commit

Permalink
fix: load env
Browse files Browse the repository at this point in the history
  • Loading branch information
RianIhsan authored Oct 28, 2023
1 parent cef33bd commit 453628e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
package main

import (
// "log"

"log"
"os"
"github.com/RianIhsan/raise-unity/routes"
"github.com/RianIhsan/raise-unity/utils/database"
"github.com/RianIhsan/raise-unity/utils/migration"
"github.com/gin-gonic/gin"
// "github.com/joho/godotenv"
"github.com/joho/godotenv"
)

func main() {
// err := godotenv.Load()
// if err != nil {
// log.Fatal("Failed to fetch .env file")
// }

_, err := os.Stat(".env")
if err == nil {
err := godotenv.Load()
if err != nil {
log.Fatal("Failed to fetch .env file")
}
}
database.InitDB()
migration.GoMigrate()

Expand Down

0 comments on commit 453628e

Please sign in to comment.