mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-21 09:48:39 +02:00
set default congig values
This commit is contained in:
parent
caded23b51
commit
492669f68a
1 changed files with 97 additions and 45 deletions
|
@ -29,9 +29,12 @@ const configSchema = z.object({
|
||||||
.optional()
|
.optional()
|
||||||
.pipe(z.string().url())
|
.pipe(z.string().url())
|
||||||
.transform((url) => url.toLowerCase()),
|
.transform((url) => url.toLowerCase()),
|
||||||
log_level: z.enum(["debug", "info", "warn", "error"]),
|
log_level: z
|
||||||
save_logs: z.boolean(),
|
.enum(["debug", "info", "warn", "error"])
|
||||||
log_failed_attempts: z.boolean().optional()
|
.optional()
|
||||||
|
.default("info"),
|
||||||
|
save_logs: z.boolean().optional().default(false),
|
||||||
|
log_failed_attempts: z.boolean().optional().default(false)
|
||||||
}),
|
}),
|
||||||
domains: z
|
domains: z
|
||||||
.record(
|
.record(
|
||||||
|
@ -41,8 +44,8 @@ const configSchema = z.object({
|
||||||
.string()
|
.string()
|
||||||
.nonempty("base_domain must not be empty")
|
.nonempty("base_domain must not be empty")
|
||||||
.transform((url) => url.toLowerCase()),
|
.transform((url) => url.toLowerCase()),
|
||||||
cert_resolver: z.string().optional(),
|
cert_resolver: z.string().optional().default("letsencrypt"),
|
||||||
prefer_wildcard_cert: z.boolean().optional()
|
prefer_wildcard_cert: z.boolean().optional().default(false)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.refine(
|
.refine(
|
||||||
|
@ -62,19 +65,42 @@ const configSchema = z.object({
|
||||||
server: z.object({
|
server: z.object({
|
||||||
integration_port: portSchema
|
integration_port: portSchema
|
||||||
.optional()
|
.optional()
|
||||||
|
.default(3003)
|
||||||
.transform(stoi)
|
.transform(stoi)
|
||||||
.pipe(portSchema.optional()),
|
.pipe(portSchema.optional()),
|
||||||
external_port: portSchema.optional().transform(stoi).pipe(portSchema),
|
external_port: portSchema
|
||||||
internal_port: portSchema.optional().transform(stoi).pipe(portSchema),
|
.optional()
|
||||||
next_port: portSchema.optional().transform(stoi).pipe(portSchema),
|
.default(3000)
|
||||||
internal_hostname: z.string().transform((url) => url.toLowerCase()),
|
.transform(stoi)
|
||||||
session_cookie_name: z.string(),
|
.pipe(portSchema),
|
||||||
resource_access_token_param: z.string(),
|
internal_port: portSchema
|
||||||
resource_access_token_headers: z.object({
|
.optional()
|
||||||
id: z.string(),
|
.default(3001)
|
||||||
token: z.string()
|
.transform(stoi)
|
||||||
}),
|
.pipe(portSchema),
|
||||||
resource_session_request_param: z.string(),
|
next_port: portSchema
|
||||||
|
.optional()
|
||||||
|
.default(3002)
|
||||||
|
.transform(stoi)
|
||||||
|
.pipe(portSchema),
|
||||||
|
internal_hostname: z
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.default("pangolin")
|
||||||
|
.transform((url) => url.toLowerCase()),
|
||||||
|
session_cookie_name: z.string().optional().default("p_session_token"),
|
||||||
|
resource_access_token_param: z.string().optional().default("p_token"),
|
||||||
|
resource_access_token_headers: z
|
||||||
|
.object({
|
||||||
|
id: z.string().optional().default("P-Access-Token-Id"),
|
||||||
|
token: z.string().optional().default("P-Access-Token")
|
||||||
|
})
|
||||||
|
.optional()
|
||||||
|
.default({}),
|
||||||
|
resource_session_request_param: z
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.default("resource_session_request_param"),
|
||||||
dashboard_session_length_hours: z
|
dashboard_session_length_hours: z
|
||||||
.number()
|
.number()
|
||||||
.positive()
|
.positive()
|
||||||
|
@ -102,35 +128,61 @@ const configSchema = z.object({
|
||||||
.transform(getEnvOrYaml("SERVER_SECRET"))
|
.transform(getEnvOrYaml("SERVER_SECRET"))
|
||||||
.pipe(z.string().min(8))
|
.pipe(z.string().min(8))
|
||||||
}),
|
}),
|
||||||
traefik: z.object({
|
traefik: z
|
||||||
http_entrypoint: z.string(),
|
.object({
|
||||||
https_entrypoint: z.string().optional(),
|
http_entrypoint: z.string().optional().default("web"),
|
||||||
additional_middlewares: z.array(z.string()).optional()
|
https_entrypoint: z.string().optional().default("websecure"),
|
||||||
}),
|
additional_middlewares: z.array(z.string()).optional()
|
||||||
gerbil: z.object({
|
})
|
||||||
start_port: portSchema.optional().transform(stoi).pipe(portSchema),
|
.optional()
|
||||||
base_endpoint: z
|
.default({}),
|
||||||
.string()
|
gerbil: z
|
||||||
.optional()
|
.object({
|
||||||
.pipe(z.string())
|
start_port: portSchema
|
||||||
.transform((url) => url.toLowerCase()),
|
.optional()
|
||||||
use_subdomain: z.boolean(),
|
.default(51820)
|
||||||
subnet_group: z.string(),
|
.transform(stoi)
|
||||||
block_size: z.number().positive().gt(0),
|
.pipe(portSchema),
|
||||||
site_block_size: z.number().positive().gt(0)
|
base_endpoint: z
|
||||||
}),
|
.string()
|
||||||
rate_limits: z.object({
|
.optional()
|
||||||
global: z.object({
|
.pipe(z.string())
|
||||||
window_minutes: z.number().positive().gt(0),
|
.transform((url) => url.toLowerCase()),
|
||||||
max_requests: z.number().positive().gt(0)
|
use_subdomain: z.boolean().optional().default(false),
|
||||||
}),
|
subnet_group: z.string().optional().default("100.89.137.0/20"),
|
||||||
auth: z
|
block_size: z.number().positive().gt(0).optional().default(24),
|
||||||
.object({
|
site_block_size: z.number().positive().gt(0).optional().default(30)
|
||||||
window_minutes: z.number().positive().gt(0),
|
})
|
||||||
max_requests: z.number().positive().gt(0)
|
.optional()
|
||||||
})
|
.default({}),
|
||||||
.optional()
|
rate_limits: z
|
||||||
}),
|
.object({
|
||||||
|
global: z
|
||||||
|
.object({
|
||||||
|
window_minutes: z
|
||||||
|
.number()
|
||||||
|
.positive()
|
||||||
|
.gt(0)
|
||||||
|
.optional()
|
||||||
|
.default(1),
|
||||||
|
max_requests: z
|
||||||
|
.number()
|
||||||
|
.positive()
|
||||||
|
.gt(0)
|
||||||
|
.optional()
|
||||||
|
.default(500)
|
||||||
|
})
|
||||||
|
.optional()
|
||||||
|
.default({}),
|
||||||
|
auth: z
|
||||||
|
.object({
|
||||||
|
window_minutes: z.number().positive().gt(0),
|
||||||
|
max_requests: z.number().positive().gt(0)
|
||||||
|
})
|
||||||
|
.optional()
|
||||||
|
})
|
||||||
|
.optional()
|
||||||
|
.default({}),
|
||||||
email: z
|
email: z
|
||||||
.object({
|
.object({
|
||||||
smtp_host: z.string().optional(),
|
smtp_host: z.string().optional(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue