fix pre-commit and cleanup

This commit is contained in:
Kjeld Schouten
2024-10-19 15:18:05 +02:00
parent 2acb59c9dc
commit 4ab41d42f2
203 changed files with 8456 additions and 8484 deletions
+22 -22
View File
@@ -1,35 +1,35 @@
package sops
import (
"fmt"
"io/ioutil"
"fmt"
"io/ioutil"
"gopkg.in/yaml.v3"
"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"`
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)
}
// 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)
}
// 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
// Print the loaded struct
// log.Info().Msgf("Loaded Config:\n%+v\n %v", config)
return config, nil
}