mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat(templates): add utility functions for template variable generation
- Implement new utility functions in template processing - Add support for generating UUID, timestamp, and random port - Extend template variable processing capabilities
This commit is contained in:
@@ -84,6 +84,18 @@ function processValue(
|
|||||||
const length = Number.parseInt(varName.split(":")[1], 10) || 8;
|
const length = Number.parseInt(varName.split(":")[1], 10) || 8;
|
||||||
return generateHash(length);
|
return generateHash(length);
|
||||||
}
|
}
|
||||||
|
if (varName === "uuid") {
|
||||||
|
return crypto.randomUUID();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (varName === "timestamp") {
|
||||||
|
return Date.now().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (varName === "randomPort") {
|
||||||
|
return Math.floor(Math.random() * 65535).toString();
|
||||||
|
}
|
||||||
|
|
||||||
// If not a utility function, try to get from variables
|
// If not a utility function, try to get from variables
|
||||||
return variables[varName] || match;
|
return variables[varName] || match;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user