sync: Report custom errors
This commit is contained in:
parent
08ea1bac0d
commit
c78545c18b
17 changed files with 510 additions and 137 deletions
|
|
@ -68,6 +68,7 @@ func main() {
|
|||
gitImporterRemote := ""
|
||||
localImporterSymlink := false
|
||||
baseURL := "/"
|
||||
checkplugins := sync.CheckPluginList{}
|
||||
|
||||
// Read paremeters from environment
|
||||
if v, exists := os.LookupEnv("FICOIDC_SECRET"); exists {
|
||||
|
|
@ -119,6 +120,7 @@ func main() {
|
|||
flag.BoolVar(&fic.OptionalDigest, "optionaldigest", fic.OptionalDigest, "Is the digest required when importing files?")
|
||||
flag.BoolVar(&fic.StrongDigest, "strongdigest", fic.StrongDigest, "Are BLAKE2b digests required or is SHA-1 good enough?")
|
||||
flag.BoolVar(&api.IsProductionEnv, "4real", api.IsProductionEnv, "Set this flag when running for a real challenge (it disallows or avoid most of mass user progression deletion)")
|
||||
flag.Var(&checkplugins, "rules-plugins", "List of libraries containing others rules to checks")
|
||||
flag.Parse()
|
||||
|
||||
log.SetPrefix("[admin] ")
|
||||
|
|
@ -211,6 +213,15 @@ func main() {
|
|||
os.MkdirAll(api.DashboardDir, 0777)
|
||||
os.MkdirAll(settings.SettingsDir, 0777)
|
||||
|
||||
// Load rules plugins
|
||||
for _, p := range checkplugins {
|
||||
if err := sync.LoadChecksPlugin(p); err != nil {
|
||||
log.Fatalf("Unable to load rule plugin %q: %s", p, err.Error())
|
||||
} else {
|
||||
log.Printf("Rules plugin %q successfully loaded", p)
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize settings and load them
|
||||
if !settings.ExistsSettings(path.Join(settings.SettingsDir, settings.SettingsFile)) {
|
||||
if err = api.ResetSettings(); err != nil {
|
||||
|
|
|
|||
Reference in a new issue