feat: .env file is optional

This commit is contained in:
2025-06-01 12:55:05 +02:00
parent e8a74999c3
commit 3f8a4024ce
2 changed files with 3 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log"
"os"
"gitea.local/admin/hspguard/cmd/hspguard/api"
"gitea.local/admin/hspguard/internal/config"
@ -16,9 +17,8 @@ import (
func main() {
err := godotenv.Load()
if err != nil {
log.Fatalln("ERR: Failed to load environment variables:", err)
return
if err != nil && os.Getenv("ENV") != "production" {
log.Fatalln("WARNING: .env file not found. Skipping...")
}
var cfg config.AppConfig

View File

@ -1,4 +1,3 @@
services:
db:
image: postgres
@ -9,4 +8,3 @@ services:
POSTGRES_PASSWORD: guard
ports:
- "5432:5432"