fix: Builder debug logging is better now

fix: www and non-www domain checker
This commit is contained in:
Andras Bacsai
2022-02-17 23:42:23 +01:00
parent ca7f3da19d
commit 24a6bcbd1e
6 changed files with 45 additions and 24 deletions

View File

@@ -21,16 +21,35 @@ export async function isSecretExists({ id, name }) {
export async function isDomainConfigured({ id, fqdn }) {
const domain = getDomain(fqdn);
const nakedDomain = domain.replace('www.', '');
const foundApp = await prisma.application.findFirst({
where: { fqdn: { endsWith: `//${domain}` }, id: { not: id } },
where: {
OR: [
{ fqdn: { endsWith: `//${nakedDomain}` } },
{ fqdn: { endsWith: `//www.${nakedDomain}` } }
],
id: { not: id }
},
select: { fqdn: true }
});
const foundService = await prisma.service.findFirst({
where: { fqdn: { endsWith: `//${domain}` }, id: { not: id } },
where: {
OR: [
{ fqdn: { endsWith: `//${nakedDomain}` } },
{ fqdn: { endsWith: `//www.${nakedDomain}` } }
],
id: { not: id }
},
select: { fqdn: true }
});
const coolifyFqdn = await prisma.setting.findFirst({
where: { fqdn: { endsWith: `//${domain}` }, id: { not: id } },
where: {
OR: [
{ fqdn: { endsWith: `//${nakedDomain}` } },
{ fqdn: { endsWith: `//www.${nakedDomain}` } }
],
id: { not: id }
},
select: { fqdn: true }
});
if (foundApp || foundService || coolifyFqdn) return true;