From e5027152ab3eff7fa15a408479c89aeaa1076358 Mon Sep 17 00:00:00 2001 From: diyaa Date: Thu, 28 May 2026 18:11:51 +0200 Subject: [PATCH] Change local backend port to 3007 --- backend/.env.example | 4 ++-- backend/scripts/generate-openapi.ts | 4 ++-- backend/src/modules/config/config.service.ts | 2 +- backend/src/modules/config/environment.spec.ts | 6 +++--- backend/src/modules/config/environment.ts | 2 +- backend/test/setup-env.ts | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/.env.example b/backend/.env.example index ce9bb7a..1fe0a10 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -1,7 +1,7 @@ NODE_ENV=development -PORT=3000 +PORT=3007 DATABASE_URL=postgresql://velody:velody@localhost:5432/velody?schema=public STORAGE_ROOT=../runtime/storage -PUBLIC_BASE_URL=http://localhost:3000 +PUBLIC_BASE_URL=http://localhost:3007 DEVICE_BOOTSTRAP_SECRET=replace-me MAX_UPLOAD_SIZE_BYTES=524288000 diff --git a/backend/scripts/generate-openapi.ts b/backend/scripts/generate-openapi.ts index 2edb331..51f4001 100644 --- a/backend/scripts/generate-openapi.ts +++ b/backend/scripts/generate-openapi.ts @@ -5,11 +5,11 @@ import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; async function generate(): Promise { process.env.NODE_ENV ??= 'development'; - process.env.PORT ??= '3000'; + process.env.PORT ??= '3007'; process.env.DATABASE_URL ??= 'postgresql://velody:velody@localhost:5432/velody?schema=public'; process.env.STORAGE_ROOT ??= join(process.cwd(), '..', 'runtime', 'storage'); - process.env.PUBLIC_BASE_URL ??= 'http://localhost:3000'; + process.env.PUBLIC_BASE_URL ??= 'http://localhost:3007'; process.env.DEVICE_BOOTSTRAP_SECRET ??= 'openapi-placeholder-secret'; process.env.MAX_UPLOAD_SIZE_BYTES ??= '524288000'; diff --git a/backend/src/modules/config/config.service.ts b/backend/src/modules/config/config.service.ts index ae940e0..f1a0122 100644 --- a/backend/src/modules/config/config.service.ts +++ b/backend/src/modules/config/config.service.ts @@ -10,7 +10,7 @@ export class AppConfigService { } get port(): number { - return Number(this.required('PORT')); + return Number(this.configService.get('PORT') ?? '3007'); } get databaseUrl(): string { diff --git a/backend/src/modules/config/environment.spec.ts b/backend/src/modules/config/environment.spec.ts index bedc2b9..50c9c7b 100644 --- a/backend/src/modules/config/environment.spec.ts +++ b/backend/src/modules/config/environment.spec.ts @@ -4,15 +4,15 @@ describe('validateEnvironment', () => { it('accepts a valid environment', () => { const result = validateEnvironment({ NODE_ENV: 'test', - PORT: '3000', + PORT: '3007', DATABASE_URL: 'postgresql://velody:velody@localhost:5432/velody?schema=public', STORAGE_ROOT: '/tmp/velody', - PUBLIC_BASE_URL: 'http://localhost:3000', + PUBLIC_BASE_URL: 'http://localhost:3007', DEVICE_BOOTSTRAP_SECRET: 'secret', MAX_UPLOAD_SIZE_BYTES: '1024', }); - expect(result.PORT).toBe(3000); + expect(result.PORT).toBe(3007); expect(result.MAX_UPLOAD_SIZE_BYTES).toBe(1024); }); diff --git a/backend/src/modules/config/environment.ts b/backend/src/modules/config/environment.ts index f21798b..1ffc9ff 100644 --- a/backend/src/modules/config/environment.ts +++ b/backend/src/modules/config/environment.ts @@ -17,7 +17,7 @@ class EnvironmentVariables { @IsInt() @Min(1) @Max(65535) - PORT!: number; + PORT: number = 3007; @IsString() @IsNotEmpty() diff --git a/backend/test/setup-env.ts b/backend/test/setup-env.ts index 498909a..1568c1e 100644 --- a/backend/test/setup-env.ts +++ b/backend/test/setup-env.ts @@ -8,7 +8,7 @@ process.env.DATABASE_URL = process.env.STORAGE_ROOT = process.env.STORAGE_ROOT ?? '/tmp/velody-storage'; process.env.PUBLIC_BASE_URL = - process.env.PUBLIC_BASE_URL ?? 'http://localhost:3000'; + process.env.PUBLIC_BASE_URL ?? 'http://localhost:3007'; process.env.DEVICE_BOOTSTRAP_SECRET = process.env.DEVICE_BOOTSTRAP_SECRET ?? 'test-secret'; process.env.MAX_UPLOAD_SIZE_BYTES =