Skip to content

Commit 6937d8f

Browse files
committed
fix: Correct port determination logic
1 parent 8a3addc commit 6937d8f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cmd/main.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,9 @@ func main() {
6060
r := setupRoutes(authHandler, userHandler, productHandler, categoryHandler, cartHandler, orderHandler, authMiddleware)
6161

6262
// --- Determine Port ---
63-
port := os.Getenv("PORT") // 1. Check Render's PORT variable
63+
port := os.Getenv("PORT") // 1. Check Render's/Environment PORT variable
6464
if port == "" {
65-
port = cfg.APIPort // 2. Check API_PORT from config (read from .env)
66-
if port == "" {
67-
port = defaultPort // 3. Use default if none is set
68-
}
65+
port = defaultPort // 2. Use default if PORT is not set
6966
}
7067
// Basic validation (optional but recommended)
7168
if _, err := strconv.Atoi(port); err != nil {

0 commit comments

Comments
 (0)