mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
fix(templates): add null checks for template config properties
Prevent potential runtime errors by adding null checks for domains, env, and mounts in template processors
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dokploy",
|
||||
"version": "v0.20.0",
|
||||
"version": "v0.20.1",
|
||||
"private": true,
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
|
||||
@@ -175,7 +175,9 @@ export function processDomains(
|
||||
variables: Record<string, string>,
|
||||
schema: Schema,
|
||||
): Template["domains"] {
|
||||
return template.config.domains.map((domain: DomainConfig) => ({
|
||||
if (!template?.config?.domains) return [];
|
||||
|
||||
return template?.config?.domains?.map((domain: DomainConfig) => ({
|
||||
...domain,
|
||||
host: domain.host
|
||||
? processValue(domain.host, variables, schema)
|
||||
@@ -191,7 +193,9 @@ export function processEnvVars(
|
||||
variables: Record<string, string>,
|
||||
schema: Schema,
|
||||
): Template["envs"] {
|
||||
return Object.entries(template.config.env).map(
|
||||
if (!template?.config?.env) return [];
|
||||
|
||||
return Object.entries(template?.config?.env).map(
|
||||
([key, value]: [string, string]) => {
|
||||
const processedValue = processValue(value, variables, schema);
|
||||
return `${key}=${processedValue}`;
|
||||
@@ -207,9 +211,9 @@ export function processMounts(
|
||||
variables: Record<string, string>,
|
||||
schema: Schema,
|
||||
): Template["mounts"] {
|
||||
if (!template.config.mounts) return [];
|
||||
if (!template?.config?.mounts) return [];
|
||||
|
||||
return template.config.mounts.map((mount: MountConfig) => ({
|
||||
return template?.config?.mounts?.map((mount: MountConfig) => ({
|
||||
filePath: processValue(mount.filePath, variables, schema),
|
||||
content: processValue(mount.content, variables, schema),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user