Skip to content

Commit

Permalink
fixing env loading for prod
Browse files Browse the repository at this point in the history
  • Loading branch information
mlinder10 committed Jun 23, 2024
1 parent 1f235a1 commit 6f0592b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import (

func main() {
// Load .env file
if err := utils.LoadEnv(); err != nil {
panic(err)
}
utils.LoadEnv()

// Create Gin router
router := gin.Default()
Expand Down
2 changes: 1 addition & 1 deletion routes/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func DBMiddleware(c *gin.Context) {
}

func AuthMiddleware(c *gin.Context) {
apiToken := os.Getenv("API_TOKEN")
apiToken := os.Getenv("API_KEY")
token := c.GetHeader("Authorization")
if token != apiToken {
c.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"})
Expand Down

0 comments on commit 6f0592b

Please sign in to comment.