this repo has no description
at main 41 lines 914 B view raw
1package processor 2 3import ( 4 "fmt" 5 6 "github.com/aottr/nox/internal/config" 7 "github.com/aottr/nox/internal/git" 8) 9 10func ValidateConfig(cfg *config.Config) error { 11 if cfg.Age.Identity == "" { 12 return fmt.Errorf("age key path is required") 13 } 14 15 if cfg.StatePath == "" { 16 fmt.Printf("state path is not set, defaulting to default.\n") 17 } 18 19 for appName, app := range cfg.Apps { 20 fmt.Printf("✅ Validating app %s\n", appName) 21 22 gitConf := app.GitConfig 23 if !gitConf.IsValid() { 24 gitConf = cfg.GitConfig 25 } 26 27 repo, err := git.CloneRepo(gitConf) 28 if err != nil { 29 return fmt.Errorf("failed to clone for app %s: %w", appName, err) 30 } 31 32 for _, file := range app.Files { 33 if !git.FileExistsInTree(repo.Tree, file.Path) { 34 return fmt.Errorf("❌ file %s missing in app %s", file, appName) 35 } 36 fmt.Printf("✔️ Found file %s in repo\n", file) 37 } 38 } 39 fmt.Println("all checks passed!") 40 return nil 41}