NextWks/src/cmd/setupcheck/main.go

40 lines
926 B
Go

package main
import (
"fmt"
"os"
)
func main() {
checks := []struct {
path string
purpose string
mustExist bool
}{
{"/opt/nextwks/config.yaml", "NextWks configuration", true},
{"/opt/nextwks/bin", "Binary output directory", true},
{"/opt/nextwks/data", "Data directory", true},
{"/opt/authelia/config/configuration.yml", "Authelia mock configuration", true},
}
allPassed := true
for _, c := range checks {
_, err := os.Stat(c.path)
if c.mustExist && os.IsNotExist(err) {
fmt.Printf("❌ MISSING: %s (%s)\n", c.path, c.purpose)
allPassed = false
} else if c.mustExist && err != nil {
fmt.Printf("❌ ERROR: %s - %v\n", c.path, err)
allPassed = false
} else {
fmt.Printf("✅ OK: %s (%s)\n", c.path, c.purpose)
}
}
if allPassed {
fmt.Println("\n✅ All system paths verified!")
} else {
fmt.Println("\n❌ Some paths are missing or have errors")
os.Exit(1)
}
}