Exemplo n.º 1
0
//nonblocking startup
func start() {
	log.Println("start")

	os.MkdirAll("data", os.ModePerm)
	d, err := db.NewDb("data/admin.db")
	if err != nil {
		log.Println("Can't open DB:", err)
		time.Sleep(100 * time.Millisecond)
		return
	}
	defer d.Close()
	db.DbFileList = append(db.DbFileList, "../gamesrv/data/game.db")

	ConfigAuth()

	/*exp, err := expression.CreateExpressionFunc("50+(n*10)")
	if err != nil {
		log.Println(err)
	} else {
		for i := 0; i < 42; i++ {
			log.Println(">>>>>>>>>>>>", i, exp(float64(i)), " ")
		}
	}*/

	InitBackup()
	Start()
	err = db.Main.ApplyRebuilds()
	if err != nil {
		panic(err)
	}
}
Exemplo n.º 2
0
func run() {
	os.MkdirAll("data", os.ModePerm)
	d, err := db.NewDb("data/game.db")
	if err != nil {
		log.Println("Can't open DB:", err)
		time.Sleep(100 * time.Millisecond)
		return
	}
	defer d.Close()

	flag.StringVar(&adminToken, "token", adminToken, "admin token")

	srv.LoadConfig()
	InitPlayerMgr()
	StartWeb()
	RunTests()
	srv.WaitForServers()
	srv.SaveState()
	time.Sleep(10 * time.Millisecond) //logger cooldown
}