A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.
fix: resolves broken custom port config override
towfiqi39d670efe9bc
diff --git a/backend/__tests__/services/ConfigService.test.ts b/backend/__tests__/services/ConfigService.test.tsindex 952df2d..bf741ed 100644--- a/backend/__tests__/services/ConfigService.test.ts+++ b/backend/__tests__/services/ConfigService.test.ts@@ -110,6 +110,15 @@ describe('ConfigService', () => {expect(mockExit).not.toHaveBeenCalled();});+ it('should derive default APP_URL from SERVER_PORT when APP_URL is not set', async () => {+ process.env = { ...validBaseEnv, NODE_ENV: 'production', SERVER_PORT: '8080' };+ mockExistsSync.mockReturnValue(false);++ const { configService } = await import('../../src/services/ConfigService');++ expect(configService.config.APP_URL).toBe('http://localhost:8080');+ });+it('should load configuration from environment variables', async () => {// Arrangeprocess.env = {diff --git a/backend/src/services/ConfigService.ts b/backend/src/services/ConfigService.tsindex 5de0112..c43a0fa 100644--- a/backend/src/services/ConfigService.ts+++ b/backend/src/services/ConfigService.ts@@ -12,7 +12,7 @@ const baseConfigSchema = z.object({// GeneralNODE_ENV: z.enum(['development', 'production', 'test']).default('production'),SERVER_PORT: z.coerce.number().int().positive().default(5173),- APP_URL: z.string().default('http://localhost:5173'),+ APP_URL: z.string().optional(),APP_TITLE: z.string().min(1).default('Pluton'),MAX_CONCURRENT_BACKUPS: z.coerce.number().int().positive().default(2),LICENSE_KEY: z.string().optional(),@@ -70,6 +70,7 @@ const userConfigSchema = baseConfigSchema// Final config schema for normal operation (requires all sensitive fields)const finalConfigSchema = configSchema.extend({+ APP_URL: z.string(),SECRET: z.string().min(12),APIKEY: z.string().min(12),PASSWORD_HASH: z.string().min(1).optional(),@@ -184,6 +185,10 @@ class ConfigService {const mergedConfig = {...envConfig,...fileConfig,+ APP_URL:+ fileConfig.APP_URL ||+ envConfig.APP_URL ||+ `http://localhost:${fileConfig.SERVER_PORT || envConfig.SERVER_PORT || 5173}`,SECRET: secrets.SECRET, // System secrets fill in the gapsAPIKEY: secrets.APIKEY,PASSWORD_HASH: passwordHash,