35 lines
978 B
Go
35 lines
978 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"os/signal"
|
|
|
|
"git.optclblast.xyz/draincloud/draincloud-core/internal/app"
|
|
cleanupsessions "git.optclblast.xyz/draincloud/draincloud-core/internal/cron/cleanup_sessions"
|
|
filesengine "git.optclblast.xyz/draincloud/draincloud-core/internal/files_engine"
|
|
"git.optclblast.xyz/draincloud/draincloud-core/internal/plugin"
|
|
"git.optclblast.xyz/draincloud/draincloud-core/internal/storage/postgres"
|
|
)
|
|
|
|
func main() {
|
|
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
|
|
defer cancel()
|
|
|
|
plugin.MustNewPluginLoader(ctx, 8081, plugin.NewPluginStore()).
|
|
Run(ctx)
|
|
|
|
pg := postgres.New(ctx, "postgres://draincloud:draincloud@localhost:5432/draincloud?sslmode=disable")
|
|
|
|
// TODO move cron on a separate job (k8s cronjob / docker cron)
|
|
cleanupSessionsCron := cleanupsessions.New(pg)
|
|
cleanupSessionsCron.Run(ctx)
|
|
|
|
engine := filesengine.NewFilesEngine(nil, nil)
|
|
|
|
go app.New(pg, engine).
|
|
Run(ctx)
|
|
|
|
<-ctx.Done()
|
|
}
|