This repository has been archived on 2025-03-01. You can view files and clone it, but cannot push or open issues or pull requests.
trantor/main.go

47 lines
828 B
Go
Raw Normal View History

2016-05-02 21:36:49 -04:00
package main
import (
log "github.com/cihub/seelog"
"net/http"
"os"
"gitlab.com/trantor/trantor/lib"
"gitlab.com/trantor/trantor/lib/database"
"gitlab.com/trantor/trantor/lib/storage"
)
const (
PORT = "8080"
DB_IP = "127.0.0.1"
DB_NAME = "trantor"
STORE_PATH = "store/"
)
func main() {
defer log.Flush()
err := trantor.UpdateLogger()
if err != nil {
log.Error("Error loading the logger xml: ", err)
}
log.Info("Start the imperial library of trantor")
db := database.Init(DB_IP, DB_NAME)
defer db.Close()
store, err := storage.Init(STORE_PATH)
if err != nil {
log.Critical("Problem initializing store: ", err)
os.Exit(1)
}
trantor.InitTasks(db)
sg := trantor.InitStats(db, store)
trantor.InitUpload(db, store)
trantor.InitRouter(db, sg)
log.Error(http.ListenAndServe(":"+PORT, nil))
}