Move all the code to a lib folder

This commit is contained in:
Las Zenow 2016-05-02 21:36:49 -04:00
parent e963d00014
commit 9d1f1ad5c0
31 changed files with 123 additions and 98 deletions

46
main.go Normal file
View file

@ -0,0 +1,46 @@
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))
}