feat: .env file is optional
This commit is contained in:
@ -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
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres
|
||||
@ -9,4 +8,3 @@ services:
|
||||
POSTGRES_PASSWORD: guard
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
|
Reference in New Issue
Block a user