-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
55 lines (40 loc) · 1.01 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
Go Judge Software
by MrOnlineCoder (github.com/MrOnlineCoder/gojudge)
(c) 2019
License: see LICENSE file
*/
package main
import (
"log"
"gojudge/server"
"gojudge/db"
"gojudge/judge"
"gojudge/contest"
"gojudge/config"
)
func main() {
log.Println("=== [GoJudge] ===");
log.Println("[Main] Loading config...");
if !config.IsPresent() {
config.SetDefault();
config.Save();
log.Println("[Main] ------------------------------------------------------------------- ");
log.Println("[Main] Default config has been set.");
log.Println("[Main] Please, configure your GoJudge installation via admin user-interface");
log.Println("[Main] ------------------------------------------------------------------- ");
} else {
config.Load();
}
log.Println("[Main] Loading database...");
if !db.Initialize() {
log.Fatal("ERROR: couldn't initialize database.")
return
}
contest.LoadContest();
judge.StartWorkers();
log.Println("[Main] Starting server...");
server.Setup();
server.Run();
db.Close();
}