Documentation
¶
Index ¶
- func GenerateFromTemplate(tmplContent string, data any, baseDir, filename string) (string, int64, error)
- func IsSafePathComponent(name string) bool
- func NormalizeVersion(v string) string
- func NormalizeVersionWithDefault(v string) string
- func SafeJoin(baseDir, name string) (string, error)
- func SortByDeploymentOrder[T any](items []T, order []string, getName func(T) string) []T
- func SortComponentNamesByDeploymentOrder(components []string, deploymentOrder []string) []string
- func SortComponentRefsByDeploymentOrder(refs []recipe.ComponentRef, order []string) []recipe.ComponentRef
- func WriteValuesFile(values map[string]any, baseDir, filename string) (string, int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateFromTemplate ¶
func GenerateFromTemplate(tmplContent string, data any, baseDir, filename string) (string, int64, error)
GenerateFromTemplate renders a template and writes it to baseDir/filename. It uses SafeJoin to verify the output path stays within baseDir.
func IsSafePathComponent ¶
IsSafePathComponent returns true if name is a single path component without any separators or parent directory references.
func NormalizeVersion ¶
NormalizeVersion removes the 'v' prefix from a version string. It returns the input unchanged if no prefix is present.
func NormalizeVersionWithDefault ¶
NormalizeVersionWithDefault removes the 'v' prefix and defaults empty strings to "0.1.0". Use this for Helm chart metadata where a version is always required.
func SafeJoin ¶
SafeJoin joins baseDir and name, then verifies the result is contained within baseDir. This prevents path traversal when name comes from untrusted input (e.g., component names from recipe data).
func SortByDeploymentOrder ¶
SortByDeploymentOrder sorts items by deployment order using getName to extract the component name from each item. Items in the order list are sorted by their position; items not in the order list are placed after ordered items and sorted alphabetically by name.
func SortComponentNamesByDeploymentOrder ¶
SortComponentNamesByDeploymentOrder sorts component name strings by deployment order.
func SortComponentRefsByDeploymentOrder ¶
func SortComponentRefsByDeploymentOrder(refs []recipe.ComponentRef, order []string) []recipe.ComponentRef
SortComponentRefsByDeploymentOrder sorts component refs by deployment order.
Types ¶
This section is empty.