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:
@@ -9,11 +9,15 @@ const MAILER_PROVIDER = z
|
||||
* @description Get the mailer based on the environment variable.
|
||||
*/
|
||||
export async function getMailer() {
|
||||
switch (MAILER_PROVIDER) {
|
||||
switch (process.env.MAILER_PROVIDER as typeof MAILER_PROVIDER) {
|
||||
case 'nodemailer': {
|
||||
const { Nodemailer } = await import('./impl/nodemailer');
|
||||
if (process.env.NEXT_RUNTIME !== 'edge') {
|
||||
const { Nodemailer } = await import('./impl/nodemailer');
|
||||
|
||||
return new Nodemailer();
|
||||
return new Nodemailer();
|
||||
} else {
|
||||
throw new Error('Nodemailer is not available on the edge runtime side');
|
||||
}
|
||||
}
|
||||
|
||||
case 'cloudflare': {
|
||||
|
||||
Reference in New Issue
Block a user