diff --git a/config/config.go b/config/config.go index 8d3dc4dd1..c29b86ab8 100644 --- a/config/config.go +++ b/config/config.go @@ -47,6 +47,8 @@ func FindConfigFile(start string) (string, error) { for i := 0; i < maxDepth; i++ { _, err := fs.Stat(path.Join(filepath, configFileName)) if err != nil { + // Check if user mispelled '.sops.yaml' + warnWrongConfigFileExtension(filepath) filepath = path.Join(filepath, "..") } else { return path.Join(filepath, configFileName), nil @@ -55,6 +57,14 @@ func FindConfigFile(start string) (string, error) { return "", fmt.Errorf("Config file not found") } +func warnWrongConfigFileExtension(filepath string) { + _, err := + fs.Stat(path.Join(filepath, ".sops.yml")) + if err == nil { + log.Printf("warning: Found unsupported '.sops.yml' config file. Rename it to '.sops.yaml' or use '--config .sops.yml' flag") + } +} + type DotenvStoreConfig struct{} type INIStoreConfig struct{}