mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-18 08:18:43 +02:00
Add config for domains
This commit is contained in:
parent
25ae169fee
commit
d000879c01
2 changed files with 26 additions and 3 deletions
|
@ -231,7 +231,29 @@ export const configSchema = z
|
|||
disable_config_managed_domains: z.boolean().optional(),
|
||||
enable_clients: z.boolean().optional()
|
||||
})
|
||||
.optional(),
|
||||
dns: z
|
||||
.object({
|
||||
nameservers: z
|
||||
.array(z.string().url())
|
||||
.optional()
|
||||
.default([
|
||||
"ns1.fossorial.io",
|
||||
"ns2.fossorial.io",
|
||||
]),
|
||||
cname_extension: z
|
||||
.string()
|
||||
.optional()
|
||||
.default("fossorial.io"),
|
||||
})
|
||||
.optional()
|
||||
.default({
|
||||
nameservers: [
|
||||
"ns1.fossorial.io",
|
||||
"ns2.fossorial.io",
|
||||
],
|
||||
cname_extension: "fossorial.io"
|
||||
}),
|
||||
})
|
||||
.refine(
|
||||
(data) => {
|
||||
|
|
|
@ -11,6 +11,7 @@ import { generateId } from "@server/auth/sessions/app";
|
|||
import { eq, and } from "drizzle-orm";
|
||||
import { isValidDomain } from "@server/lib/validators";
|
||||
import { build } from "@server/build";
|
||||
import config from "@server/lib/config";
|
||||
|
||||
const paramsSchema = z
|
||||
.object({
|
||||
|
@ -228,15 +229,15 @@ export async function createOrgDomain(
|
|||
|
||||
// TODO: This needs to be cross region and not hardcoded
|
||||
if (type === "ns") {
|
||||
nsRecords = ["ns-east.fossorial.io", "ns-west.fossorial.io"];
|
||||
nsRecords = config.getRawConfig().dns.nameservers;
|
||||
} else if (type === "cname") {
|
||||
cnameRecords = [
|
||||
{
|
||||
value: `${domainId}.cname.fossorial.io`,
|
||||
value: `${domainId}.${config.getRawConfig().dns.cname_extension}`,
|
||||
baseDomain: baseDomain
|
||||
},
|
||||
{
|
||||
value: `_acme-challenge.${domainId}.cname.fossorial.io`,
|
||||
value: `_acme-challenge.${domainId}.${config.getRawConfig().dns.cname_extension}`,
|
||||
baseDomain: `_acme-challenge.${baseDomain}`
|
||||
}
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue