fix: refactor for .env loading
This commit is contained in:
parent
7d869ea36d
commit
69e3133563
5 changed files with 24 additions and 6 deletions
8
main.go
8
main.go
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue