This commit is contained in:
drainpilled 2024-10-20 05:12:54 -04:00
parent 0cef1773a7
commit f8f10b7c15
4 changed files with 15 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import (
"git.optclblast.xyz/draincloud/draincloud-core/internal/app" "git.optclblast.xyz/draincloud/draincloud-core/internal/app"
"git.optclblast.xyz/draincloud/draincloud-core/internal/plugin" "git.optclblast.xyz/draincloud/draincloud-core/internal/plugin"
"git.optclblast.xyz/draincloud/draincloud-core/internal/storage/postgres"
) )
func main() { func main() {
@ -12,5 +13,8 @@ func main() {
ps := plugin.NewPluginStore() ps := plugin.NewPluginStore()
pl := plugin.MustNewPluginLoader(ctx, 8081, ps) pl := plugin.MustNewPluginLoader(ctx, 8081, ps)
pl.Run(ctx) pl.Run(ctx)
app.New().Run(context.TODO())
pg := postgres.New(ctx, "postgres://draincloud:draincloud_secret@localhost:5432/draincloud?sslmode=disable")
app.New(pg).Run(context.TODO())
} }

View File

@ -7,9 +7,9 @@ services:
environment: environment:
POSTGRES_USERNAME: draincloud POSTGRES_USERNAME: draincloud
POSTGRES_DB: draincloud POSTGRES_DB: draincloud
POSTGRES_PASSWORD: draincloud.dev.secret POSTGRES_PASSWORD: draincloud_secret
volumes: volumes:
- draincloud-db-data:/ - draincloud-db-data:/var/lib/postgresql/data
volumes: volumes:
draincloud-db-data: {} draincloud-db-data: {}

View File

@ -20,11 +20,16 @@ type DrainCloud struct {
datadase storage.Database datadase storage.Database
} }
func New() *DrainCloud { func New(
datadase storage.Database,
) *DrainCloud {
mux := gin.Default() mux := gin.Default()
d := new(DrainCloud) d := &DrainCloud{
datadase: datadase,
}
// Built-in auth component of DrainCloud-Core
authGroup := mux.Group("/auth") authGroup := mux.Group("/auth")
{ {
authGroup.POST("/register", d.Register) authGroup.POST("/register", d.Register)

View File

@ -4,7 +4,7 @@ import "time"
type Session struct { type Session struct {
ID string ID string
User *User User *User
} }
type User struct { type User struct {