lab4 done

This commit is contained in:
Khakimov Dmitrij
2026-10-28 22:41:10 +03:00
parent a7bedda183
commit dbc700fafe
75 changed files with 5611 additions and 227 deletions
+8 -3
View File
@@ -15,6 +15,7 @@ import (
"github.com/redis/go-redis/v9"
"gitflic.ru/akselbant/mtusi2026lab1-fork/internal/app/chat"
"gitflic.ru/akselbant/mtusi2026lab1-fork/internal/attachment"
"gitflic.ru/akselbant/mtusi2026lab1-fork/internal/config"
"gitflic.ru/akselbant/mtusi2026lab1-fork/internal/pkg/repository/postgres"
"gitflic.ru/akselbant/mtusi2026lab1-fork/internal/pkg/session"
@@ -58,12 +59,16 @@ func main() {
repo := postgres.New(pool, cfg.QueryTimeout)
sessions := session.NewRedis(redisClient, cfg.QueryTimeout)
useCase := chatusecase.New(repo, sessions, cfg.SessionTTL)
handler := chat.NewChat(useCase, cfg.CursorKey)
objectStore, err := attachment.NewStore(cfg.S3Endpoint, cfg.S3Bucket, cfg.S3AccessKey, cfg.S3SecretKey, cfg.S3UseSSL)
if err != nil {
log.Fatal("invalid S3 config")
}
handler := chat.NewChat(useCase, cfg.CursorKey).WithAttachments(attachment.New(pool, objectStore))
port := cfg.Port
e := handler.Router()
e.Server.ReadHeaderTimeout = 5 * time.Second
e.Server.ReadTimeout = 10 * time.Second
e.Server.WriteTimeout = 15 * time.Second
e.Server.ReadTimeout = 50 * time.Second
e.Server.WriteTimeout = 55 * time.Second
e.Server.IdleTimeout = 60 * time.Second
serverErrors := make(chan error, 1)