mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-30 23:55:49 +02:00
save
This commit is contained in:
parent
a35e24bc0e
commit
62238948e0
2 changed files with 37 additions and 10 deletions
|
@ -34,15 +34,27 @@ const configSchema = z.object({
|
|||
.transform(getEnvOrYaml("APP_DASHBOARDURL"))
|
||||
.pipe(z.string().url())
|
||||
.transform((url) => url.toLowerCase()),
|
||||
base_domain: hostnameSchema
|
||||
.optional()
|
||||
.transform(getEnvOrYaml("APP_BASEDOMAIN"))
|
||||
.pipe(hostnameSchema)
|
||||
.transform((url) => url.toLowerCase()),
|
||||
log_level: z.enum(["debug", "info", "warn", "error"]),
|
||||
save_logs: z.boolean(),
|
||||
log_failed_attempts: z.boolean().optional()
|
||||
}),
|
||||
domains: z
|
||||
.array(
|
||||
z.object({
|
||||
base_domain: hostnameSchema.transform((url) =>
|
||||
url.toLowerCase()
|
||||
)
|
||||
})
|
||||
)
|
||||
.refine(
|
||||
(data) => {
|
||||
const baseDomains = data.map((d) => d.base_domain);
|
||||
return new Set(baseDomains).size === baseDomains.length;
|
||||
},
|
||||
{
|
||||
message: "Base domains must be unique"
|
||||
}
|
||||
),
|
||||
server: z.object({
|
||||
external_port: portSchema
|
||||
.optional()
|
||||
|
@ -283,10 +295,6 @@ export class Config {
|
|||
return this.rawConfig;
|
||||
}
|
||||
|
||||
public getBaseDomain(): string {
|
||||
return this.rawConfig.app.base_domain;
|
||||
}
|
||||
|
||||
public getNoReplyEmail(): string | undefined {
|
||||
return (
|
||||
this.rawConfig.email?.no_reply || this.rawConfig.email?.smtp_user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue