draincloud-core/cmd/main.go
2024-11-23 03:52:06 -05:00

31 lines
773 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"
"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")
cleanupSessionsCron := cleanupsessions.New(pg)
cleanupSessionsCron.Run(ctx)
go app.New(pg).
Run(ctx)
<-ctx.Done()
}