Andre Henriques
0ac6ac8dce
Reviewed-on: #102 Co-authored-by: Andre Henriques <andr3h3nriqu3s@gmail.com> Co-committed-by: Andre Henriques <andr3h3nriqu3s@gmail.com>
56 lines
1.2 KiB
Go
56 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/charmbracelet/log"
|
|
_ "github.com/lib/pq"
|
|
|
|
"git.andr3h3nriqu3s.com/andr3/fyp/logic/db"
|
|
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/models"
|
|
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/stats"
|
|
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/tasks"
|
|
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/tasks/runner"
|
|
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/users"
|
|
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/utils"
|
|
)
|
|
|
|
const (
|
|
host = "localhost"
|
|
port = 5432
|
|
user = "postgres"
|
|
password = "verysafepassword"
|
|
dbname = "aistuff"
|
|
)
|
|
|
|
func main() {
|
|
|
|
psqlInfo := fmt.Sprintf("host=%s port=%d user=%s "+
|
|
"password=%s dbname=%s sslmode=disable",
|
|
host, port, user, password, dbname)
|
|
|
|
db := db.StartUp(psqlInfo)
|
|
defer db.Close()
|
|
|
|
config := LoadConfig()
|
|
log.Info("Config loaded!", "config", config)
|
|
config.GenerateToken(db)
|
|
|
|
//TODO check if file structure exists to save data
|
|
handle := NewHandler(db, config)
|
|
|
|
StartRunners(db, config, handle)
|
|
|
|
config.Cleanup(db)
|
|
|
|
// TODO Handle this in other way
|
|
handle.ReadTypesFilesApi("/savedData/", ".", []string{".png", ".jpeg"}, []string{"image/png", "image/jpeg"})
|
|
|
|
UsersEndpints(db, handle)
|
|
HandleModels(handle)
|
|
HandleTasks(handle)
|
|
HandleStats(handle)
|
|
|
|
handle.Startup()
|
|
}
|