fix(permission): globalize and fixes

Permission alert frop OpenGrep is wrong, as the directory must use 0755.
To make things working and to ease futur changes, I set the default
permission in a constant.
This commit is contained in:
2025-07-06 11:39:19 +02:00
parent e58948bb44
commit 09c2c86d59
6 changed files with 18 additions and 12 deletions

View File

@@ -95,7 +95,7 @@ func (chart *HelmChart) SaveTemplates(templateDir string) {
}
servicename := template.Servicename
if err := os.MkdirAll(filepath.Join(templateDir, servicename), 0o600); err != nil {
if err := os.MkdirAll(filepath.Join(templateDir, servicename), utils.DirectoryPermission); err != nil {
fmt.Println(utils.IconFailure, err)
os.Exit(1)
}
@@ -103,7 +103,7 @@ func (chart *HelmChart) SaveTemplates(templateDir string) {
// if the name is a path, create the directory
if strings.Contains(name, string(filepath.Separator)) {
name = filepath.Join(templateDir, name)
err := os.MkdirAll(filepath.Dir(name), 0o600)
err := os.MkdirAll(filepath.Dir(name), utils.DirectoryPermission)
if err != nil {
fmt.Println(utils.IconFailure, err)
os.Exit(1)