add Location class

This commit is contained in:
Girish Ramakrishnan
2023-08-17 10:44:07 +05:30
parent de7879afb5
commit 3d0ba557e5
4 changed files with 38 additions and 18 deletions

View File

@@ -33,6 +33,7 @@ const assert = require('assert'),
eventlog = require('./eventlog.js'),
hat = require('./hat.js'),
infra = require('./infra_version.js'),
Location = require('./location.js'),
mail = require('./mail.js'),
os = require('os'),
path = require('path'),
@@ -250,13 +251,10 @@ async function checkCertificate() {
}
async function getLocation() {
const domain = await settings.get(settings.MAIL_DOMAIN_KEY);
const subdomain = await settings.get(settings.MAIL_SUBDOMAIN_KEY);
const domain = await settings.get(settings.MAIL_DOMAIN_KEY);
if (!domain || !subdomain) return {};
const fqdn = dns.fqdn(subdomain, domain);
return { subdomain, domain, fqdn };
return new Location(subdomain, domain, Location.TYPE_MAIL);
}
async function changeLocation(auditSource, progressCallback) {