Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/defaults/development.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions modules/auth/controllers/auth.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions modules/auth/tests/auth.integration.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)', () => {
Expand Down
Loading