Add HMAC function, and update the CMS and Mailer services
A new module has been added to create HMACs, primarily used in the billing service for data verification. Keystatic CMS usage has been conditioned to Node.js runtime only, and a fallback to the mock CMS client has been implemented for Edge Runtime. Mailer services now accommodate environment-specific providers.
This commit is contained in:
@@ -34,7 +34,21 @@ async function getWordpressClient() {
|
||||
}
|
||||
|
||||
async function getKeystaticClient() {
|
||||
const { KeystaticClient } = await import('../../keystatic/src/client');
|
||||
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
||||
const { KeystaticClient } = await import('../../keystatic/src/client');
|
||||
|
||||
return new KeystaticClient();
|
||||
return new KeystaticClient();
|
||||
}
|
||||
|
||||
console.error(`[CMS] Keystatic client is only available in Node.js runtime. Please choose a different CMS client. Returning a mock client instead of throwing an error.`);
|
||||
|
||||
return mockCMSClient();
|
||||
}
|
||||
|
||||
function mockCMSClient() {
|
||||
return {
|
||||
async getContentItems() {
|
||||
return [];
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user