refactor: extract inlined dkim options to config file
This commit is contained in:
parent
3e429732c8
commit
2f663f0e08
5
config/dkim.json
Normal file
5
config/dkim.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"domainName": "cohabit.fr",
|
||||
"keySelector": "sendmailY2024M03",
|
||||
"privateKey": "/etc/ssl/certs/dkim_keys/dkimMailKey.pem"
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
// @deno-types="npm:@types/nodemailer"
|
||||
import nodemailer from 'nodemailer'
|
||||
import dkim from '../config/dkim.json' with { type: 'json' }
|
||||
|
||||
export async function transporter() {
|
||||
const dkimPath =
|
||||
'/home/julien/dkim_sendmail_keys/dkim_sendmail_cohabit_fr.pem'
|
||||
const dkimPath = dkim.privateKey
|
||||
const dkimPrivateKey = await Deno.readTextFile(dkimPath).catch((cause) => {
|
||||
throw new Error(`unable to load DKIM private key from "${dkimPath}"`, {
|
||||
cause,
|
||||
|
@ -15,8 +15,8 @@ export async function transporter() {
|
|||
newline: 'unix',
|
||||
path: '/usr/sbin/sendmail',
|
||||
dkim: {
|
||||
domainName: 'cohabit.fr',
|
||||
keySelector: 'sendmailY2024M03',
|
||||
domainName: dkim.domainName,
|
||||
keySelector: dkim.keySelector,
|
||||
privateKey: dkimPrivateKey,
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue