update: the domain service2

This commit is contained in:
mahyargdz
2025-07-10 16:47:14 +03:30
parent dd3eca553e
commit 233370ffb5
@@ -19,6 +19,7 @@ import { DomainRepository } from "../repositories/domain.repository";
export class DomainsService {
private readonly logger = new Logger(DomainsService.name);
private readonly businessDomain = "danakcorp.com";
private readonly dkimSelectorName = "default._domainkey";
constructor(
private readonly domainRepository: DomainRepository,
@@ -139,8 +140,11 @@ export class DomainsService {
domain.dkimPrivateKey = dkimKeys.privateKey;
domain.dkimPublicKey = dkimKeys.publicKey;
// const dkimNameParts = dkimKeys.dnsTxt.name.split(".");
// const dkimSelector = dkimNameParts.slice(0, 2).join("."); // Takes first two parts: "default._domainkey"
// Create DKIM DNS record
await this.dnsService.createDKIMRecord(domain, selector, dkimKeys.dnsTxt.name, dkimKeys.dnsTxt.value, dkimKeys.wildduckId);
await this.dnsService.createDKIMRecord(domain, selector, this.dkimSelectorName, dkimKeys.dnsTxt.value, dkimKeys.wildduckId);
this.logger.log(`DKIM automatically enabled for domain ${domain.name}`);
} catch (error) {