godotenv setup

This commit is contained in:
2024-02-21 13:10:32 -06:00
parent 1640e0d6ed
commit b24e476f9c
2 changed files with 10 additions and 0 deletions

BIN
go-crud

Binary file not shown.

10
main.go
View File

@@ -1,11 +1,21 @@
package main
import (
"log"
"net/http"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
)
func init() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
}
func main() {
r := gin.Default()