From 93c623f70705a4fa721d3337be98fdb50f5d1c9f Mon Sep 17 00:00:00 2001 From: Pierre Brisorgueil Date: Mon, 8 Jun 2026 19:33:34 +0200 Subject: [PATCH] feat(auth): expose app version in GET /api/auth/config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Footer needs the running API version to display build info. Resolution: build-arg DEVKIT_NODE_app_version → config.app.version → package.json version → 'dev'. --- config/defaults/development.config.js | 1 + modules/auth/controllers/auth.controller.js | 7 +++++++ modules/auth/tests/auth.integration.tests.js | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/config/defaults/development.config.js b/config/defaults/development.config.js index 79676b493..eb0d3dd2d 100644 --- a/config/defaults/development.config.js +++ b/config/defaults/development.config.js @@ -13,6 +13,7 @@ const config = { keywords: 'node, express, mongo, jwt, stack, boilerplate', googleAnalyticsTrackingID: 'DEVKIT_NODE_app_googleAnalyticsTrackingID', contact: 'contact@example.com', + version: '', // app release version — overridden at build via DEVKIT_NODE_app_version (Layer 4 env override); getConfig falls back to package.json version }, swagger: { enable: true, diff --git a/modules/auth/controllers/auth.controller.js b/modules/auth/controllers/auth.controller.js index a4fb51ac1..438f9d3cc 100644 --- a/modules/auth/controllers/auth.controller.js +++ b/modules/auth/controllers/auth.controller.js @@ -626,6 +626,13 @@ const getConfig = async (req, res) => { mail: { configured: isMailerConfigured(), }, + app: { + version: (() => { + const v = config.app?.version; + if (v && !String(v).startsWith('DEVKIT_NODE_')) return v; + return config.package?.version || 'dev'; + })(), + }, }; // Authenticated users get extended org config and billing config diff --git a/modules/auth/tests/auth.integration.tests.js b/modules/auth/tests/auth.integration.tests.js index fe3c58f2a..37352c9ce 100644 --- a/modules/auth/tests/auth.integration.tests.js +++ b/modules/auth/tests/auth.integration.tests.js @@ -1548,6 +1548,13 @@ describe('Auth integration tests:', () => { const result = await agent.get('/api/auth/config').expect(200); expect(result.body.data.billing).toBeUndefined(); }); + + test('should expose app.version in the public config', async () => { + const result = await agent.get('/api/auth/config').expect(200); + expect(result.body.data.app).toBeDefined(); + expect(typeof result.body.data.app.version).toBe('string'); + expect(result.body.data.app.version.length).toBeGreaterThan(0); + }); }); describe('Config endpoint (authenticated)', () => {