WEB-600 feat:External National ID System integration for client creation/editing (#3145)

improve
This commit is contained in:
Shubham Kumar
2026-02-13 13:40:19 -06:00
committed by GitHub
parent ec6ec2edc1
commit 1ea9f88bb2
23 changed files with 752 additions and 21 deletions
+32
View File
@@ -40,5 +40,37 @@ module.exports = [
res.end('Proxy error: ' + (err && err.message ? err.message : 'Unknown error'));
}
}
},
{
context: ['/external-nationalid'],
target: 'https://apis.mifos.community',
pathRewrite: { '^/external-nationalid': '/1.0/nationalid' },
changeOrigin: true,
secure: true,
logLevel: 'debug',
onProxyReq: function (proxyReq, req, res) {
// Inject API key server-side (same as nginx proxy_set_header in production)
const apiKey = process.env.EXTERNAL_NATIONAL_ID_SYSTEM_API_KEY || '';
if (apiKey) {
proxyReq.setHeader('X-Gravitee-Api-Key', apiKey);
}
const rewrittenPath = (req.url || '').replace(/^\/external-nationalid/, '/1.0/nationalid');
console.log('[Proxy] Proxying:', req.method, req.url, '->', this.target + rewrittenPath);
},
onError: function (err, req, res) {
console.error(
'[Proxy] Error while proxying request:',
req && req.method,
req && req.url,
'->',
this.target,
'-',
err && err.message
);
if (res && !res.headersSent) {
res.writeHead(502, { 'Content-Type': 'text/plain' });
res.end('Proxy error: ' + (err && err.message ? err.message : 'Unknown error'));
}
}
}
];