draincloud-core/cmd/main.go

34 lines
913 B
Go
Raw Normal View History

2024-09-27 22:37:58 +00:00
package main
2024-10-10 21:36:51 +00:00
import (
"context"
2024-11-23 08:52:06 +00:00
"os"
"os/signal"
2024-10-10 21:36:51 +00:00
"git.optclblast.xyz/draincloud/draincloud-core/internal/app"
2024-11-23 08:52:06 +00:00
cleanupsessions "git.optclblast.xyz/draincloud/draincloud-core/internal/cron/cleanup_sessions"
2024-11-29 05:23:56 +00:00
filesengine "git.optclblast.xyz/draincloud/draincloud-core/internal/files_engine"
2024-10-19 23:05:34 +00:00
"git.optclblast.xyz/draincloud/draincloud-core/internal/plugin"
2024-10-20 09:12:54 +00:00
"git.optclblast.xyz/draincloud/draincloud-core/internal/storage/postgres"
2024-10-10 21:36:51 +00:00
)
2024-09-27 22:37:58 +00:00
2024-10-10 21:36:51 +00:00
func main() {
2024-11-23 08:52:06 +00:00
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
defer cancel()
2024-10-20 09:12:54 +00:00
2024-10-27 05:07:27 +00:00
plugin.MustNewPluginLoader(ctx, 8081, plugin.NewPluginStore()).
Run(ctx)
2024-10-20 09:12:54 +00:00
2024-10-27 05:07:27 +00:00
pg := postgres.New(ctx, "postgres://draincloud:draincloud@localhost:5432/draincloud?sslmode=disable")
2024-11-23 08:52:06 +00:00
cleanupSessionsCron := cleanupsessions.New(pg)
cleanupSessionsCron.Run(ctx)
2024-11-29 05:23:56 +00:00
engine := filesengine.NewFilesEngine(nil, nil)
go app.New(pg, engine).
2024-10-27 05:07:27 +00:00
Run(ctx)
2024-11-23 08:52:06 +00:00
<-ctx.Done()
2024-09-27 22:37:58 +00:00
}