integrate clustertool sourcecode

This commit is contained in:
Kjeld Schouten
2024-10-16 14:06:31 +02:00
parent bc2a642e7a
commit 6365c6205f
265 changed files with 24073 additions and 45 deletions
+35
View File
@@ -0,0 +1,35 @@
package sops
import (
"fmt"
"io/ioutil"
"gopkg.in/yaml.v3"
)
type SopsConfig struct {
CreationRules []struct {
PathRegex string `yaml:"path_regex"`
EncryptedRegex string `yaml:"encrypted_regex,omitempty"`
Age string `yaml:"age"`
} `yaml:"creation_rules"`
}
func LoadSopsConfig() (SopsConfig, error) {
// Read .sops.yaml file
data, err := ioutil.ReadFile(".sops.yaml")
if err != nil {
return SopsConfig{}, fmt.Errorf("error reading file: %v", err)
}
// Unmarshal YAML data into struct
var config SopsConfig
err = yaml.Unmarshal(data, &config)
if err != nil {
return SopsConfig{}, fmt.Errorf("error unmarshaling YAML: %v", err)
}
// Print the loaded struct
// log.Info().Msgf("Loaded Config:\n%+v\n %v", config)
return config, nil
}