Skip to content

Commit 608b6de

Browse files
mcollinaclaude
andauthored
fix: rename PORT to WATT_ADMIN_PORT to avoid .env collisions (#175)
PORT is a very common env var used by many tools and projects. Using it as the server port placeholder in watt.json meant any .env file with PORT set would unintentionally change the admin dashboard port. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 02dd11e commit 608b6de

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

.env.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
PLT_BACKEND_TYPESCRIPT=true
2-
PORT=4042
2+
WATT_ADMIN_PORT=4042

lib/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function start (client, selectedRuntime) {
2222
}
2323
})
2424

25-
process.env.PORT = port || 4042
25+
process.env.WATT_ADMIN_PORT = port || 4042
2626

2727
const requestRecord = async (mode) => {
2828
return await request(`${entrypointUrl}/api/record/${selectedRuntime}`, {

test/start.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('start', () => {
6868
beforeEach(() => {
6969
mockServer.started = false
7070
delete process.env.SELECTED_RUNTIME
71-
delete process.env.PORT
71+
delete process.env.WATT_ADMIN_PORT
7272

7373
// Default parseArgs result
7474
parseArgsResult = { values: {} }

watt.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://schemas.platformatic.dev/wattpm/3.11.0.json",
33
"server": {
44
"hostname": "127.0.0.1",
5-
"port": "{PORT}"
5+
"port": "{WATT_ADMIN_PORT}"
66
},
77
"logger": {
88
"level": "info"

web/frontend/playwright.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig, devices } from '@playwright/test'
22

3-
const PORT = process.env.PORT || '5042'
3+
const PORT = process.env.WATT_ADMIN_PORT || '5042'
44
const baseURL = `http://127.0.0.1:${PORT}`
55
const timeout = 60000
66

@@ -21,7 +21,7 @@ export default defineConfig({
2121
timeout,
2222
stdout: 'pipe',
2323
stderr: 'pipe',
24-
env: { PORT, INCLUDE_ADMIN: '1', CI: '1' }
24+
env: { WATT_ADMIN_PORT: PORT, INCLUDE_ADMIN: '1', CI: '1' }
2525
},
2626
timeout
2727
})

0 commit comments

Comments
 (0)