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"
|
// @deno-types="npm:@types/nodemailer"
|
||||||
import nodemailer from 'nodemailer'
|
import nodemailer from 'nodemailer'
|
||||||
|
import dkim from '../config/dkim.json' with { type: 'json' }
|
||||||
|
|
||||||
export async function transporter() {
|
export async function transporter() {
|
||||||
const dkimPath =
|
const dkimPath = dkim.privateKey
|
||||||
'/home/julien/dkim_sendmail_keys/dkim_sendmail_cohabit_fr.pem'
|
|
||||||
const dkimPrivateKey = await Deno.readTextFile(dkimPath).catch((cause) => {
|
const dkimPrivateKey = await Deno.readTextFile(dkimPath).catch((cause) => {
|
||||||
throw new Error(`unable to load DKIM private key from "${dkimPath}"`, {
|
throw new Error(`unable to load DKIM private key from "${dkimPath}"`, {
|
||||||
cause,
|
cause,
|
||||||
|
@ -15,8 +15,8 @@ export async function transporter() {
|
||||||
newline: 'unix',
|
newline: 'unix',
|
||||||
path: '/usr/sbin/sendmail',
|
path: '/usr/sbin/sendmail',
|
||||||
dkim: {
|
dkim: {
|
||||||
domainName: 'cohabit.fr',
|
domainName: dkim.domainName,
|
||||||
keySelector: 'sendmailY2024M03',
|
keySelector: dkim.keySelector,
|
||||||
privateKey: dkimPrivateKey,
|
privateKey: dkimPrivateKey,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue