Skip to content

Commit

Permalink
fix(clustertool): dont try to load sops.yaml if it doesn't exist, loa…
Browse files Browse the repository at this point in the history
…d empty instead
  • Loading branch information
PrivatePuffin committed Nov 7, 2024
1 parent 93fad46 commit 81f6808
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions clustertool/pkg/sops/loadsops.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sops
import (
"fmt"
"io/ioutil"
"os"

"github.com/rs/zerolog/log"
"gopkg.in/yaml.v3"
Expand All @@ -19,6 +20,15 @@ type SopsConfig struct {
func LoadSopsConfig() (SopsConfig, error) {
log.Trace().Msg("Starting LoadSopsConfig function")

if _, err := os.Stat(".sops.yaml"); os.IsNotExist(err) {
log.Info().Msg(".sops.yaml file does not exist, skipping loading SOPS....")
return SopsConfig{}, fmt.Errorf("error reading file: %v", err)
} else if err != nil {
log.Error().Msgf("Error checking .sops.yaml file :", err)
} else {
log.Debug().Msg(".sops.yaml File exists.")
}

// Read .sops.yaml file
data, err := ioutil.ReadFile(".sops.yaml")
if err != nil {
Expand Down

0 comments on commit 81f6808

Please sign in to comment.