Skip to content

Commit 7e61c7f

Browse files
refactor: improve environment variable loading in database configuration
- Remove unnecessary logging when loading environment variables from .env file - Clarify that loading from .env is optional for local development, while Docker containers use direct environment variables
1 parent 1ba36cc commit 7e61c7f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

server/internal/database/database.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"database/sql"
66
"encoding/json"
77
"fmt"
8-
"log"
98
"os"
109
"time"
1110

@@ -126,10 +125,11 @@ func (d *Database) RunMigrations() error {
126125

127126
// GetConfigFromEnv loads database configuration from environment variables
128127
func GetConfigFromEnv() Config {
129-
// Load environment variables from .env file
130-
err := godotenv.Load()
131-
if err != nil {
132-
log.Printf("Error loading .env file: %v", err)
128+
// Load environment variables from .env file (optional - for local development)
129+
// In Docker containers, environment variables are passed directly
130+
if err := godotenv.Load(); err != nil {
131+
// Don't log error - this is expected in Docker containers
132+
// where environment variables are passed via --env-file or -e flags
133133
}
134134

135135
return Config{

0 commit comments

Comments
 (0)