mirror of
https://github.com/ershisan99/coolify.git
synced 2026-01-28 21:02:05 +00:00
fix: Minio urls + domain checks
This commit is contained in:
@@ -10,12 +10,14 @@ export const post: RequestHandler = async (event) => {
|
||||
if (status === 401) return { status, body };
|
||||
|
||||
const { id } = event.params;
|
||||
let { fqdn, exposePort } = await event.request.json();
|
||||
let { fqdn, exposePort, otherFqdns } = await event.request.json();
|
||||
|
||||
if (fqdn) fqdn = fqdn.toLowerCase();
|
||||
if (otherFqdns) otherFqdns = otherFqdns.map((fqdn) => fqdn.toLowerCase());
|
||||
if (exposePort) exposePort = Number(exposePort);
|
||||
|
||||
try {
|
||||
const found = await db.isDomainConfigured({ id, fqdn });
|
||||
let found = await db.isDomainConfigured({ id, fqdn });
|
||||
if (found) {
|
||||
throw {
|
||||
message: t.get('application.domain_already_in_use', {
|
||||
@@ -23,6 +25,20 @@ export const post: RequestHandler = async (event) => {
|
||||
})
|
||||
};
|
||||
}
|
||||
if (otherFqdns) {
|
||||
for (const ofqdn of otherFqdns) {
|
||||
const domain = getDomain(ofqdn);
|
||||
const nakedDomain = domain.replace('www.', '');
|
||||
found = await db.isDomainConfigured({ id, fqdn: ofqdn, checkOwn: true });
|
||||
if (found) {
|
||||
throw {
|
||||
message: t.get('application.domain_already_in_use', {
|
||||
domain: nakedDomain
|
||||
})
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exposePort) {
|
||||
exposePort = Number(exposePort);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user