fix: refactor for .env loading

This commit is contained in:
grngxd 2025-05-05 13:48:16 +01:00
parent 7d869ea36d
commit 69e3133563
5 changed files with 24 additions and 6 deletions

View file

@ -1,9 +1,11 @@
package main
import (
"github.com/gin-gonic/gin"
"log"
"os"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
"stereo.cat/backend/internal/api"
"stereo.cat/backend/internal/types"
)
@ -16,7 +18,9 @@ func getEnv(key, fallback string) string {
}
func main() {
imagePath := getEnv("IMAGE_PATH", "/tmp")
_ = godotenv.Load()
imagePath := getEnv("IMAGE_PATH", os.TempDir())
if _, err := os.Stat(imagePath); err != nil {
if os.IsNotExist(err) {