Skip to content

Commit 2cd5bab

Browse files
committed
add health endpoint
1 parent fb44541 commit 2cd5bab

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

embedg-server/api/handlers/send_message/restore.go

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ func (h *SendMessageHandler) HandleRestoreMessageFromWebhook(c *fiber.Ctx, req w
101101
func downloadMessageAttachments(attachments []*discordgo.MessageAttachment) (files []*wire.MessageAttachmentWire) {
102102
filesC := make(chan *wire.MessageAttachmentWire)
103103

104+
// TODO: can this block forever?
105+
104106
for _, attachment := range attachments {
105107
go func(attachment *discordgo.MessageAttachment) {
106108
if attachment.Size > 8*1024*1024 {

embedg-server/api/routes.go

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import (
2828
)
2929

3030
func registerRoutes(app *fiber.App, stores *stores, bot *bot.Bot, managers *managers) {
31+
app.Get("/api/health", func(c *fiber.Ctx) error {
32+
return c.SendStatus(fiber.StatusOK)
33+
})
34+
3135
authHandler := auth.New(stores.pg, bot, managers.session)
3236
app.Get("/api/auth/login", authHandler.HandleAuthRedirect)
3337
app.Get("/api/auth/callback", authHandler.HandleAuthCallback)

embedg-server/db/s3/files.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ const imagesBucketName = "images"
1212

1313
func (s *BlobStore) UploadFile(ctx context.Context, image *Image) error {
1414
reader := bytes.NewReader(image.Body)
15-
_, err := s.client.PutObject(ctx, imagesBucketName, image.FileName, reader, int64(len(image.Body)), minio.PutObjectOptions{})
15+
_, err := s.client.PutObject(ctx, imagesBucketName, image.FileName, reader, int64(len(image.Body)), minio.PutObjectOptions{
16+
ContentType: image.ContentType,
17+
})
1618
if err != nil {
1719
return err
1820
}

0 commit comments

Comments
 (0)