fix: mongo fail issue

This commit is contained in:
Samuel Tariku 2025-06-16 23:59:24 +03:00
parent 503333589b
commit bfba23bc69
2 changed files with 2 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import (
func InitLogger() (*zap.Logger, error) {
mongoCore, err := NewMongoCore(
"mongodb://root:secret@mongo:27017/?authSource=admin",
"mongodb://root:secret@localhost:27017/?authSource=admin",
"logdb",
"applogs",
zapcore.InfoLevel,

View File

@ -12,7 +12,7 @@ import (
func GetLogsHandler(appCtx context.Context) fiber.Handler {
return func(c *fiber.Ctx) error {
client, err := mongo.Connect(appCtx, options.Client().ApplyURI("mongodb://root:secret@mongo:27017/?authSource=admin"))
client, err := mongo.Connect(appCtx, options.Client().ApplyURI("mongodb://root:secret@localhost:27017/?authSource=admin"))
if err != nil {
return fiber.NewError(fiber.StatusInternalServerError, "MongoDB connection failed: "+err.Error())
}
@ -32,7 +32,6 @@ func GetLogsHandler(appCtx context.Context) fiber.Handler {
return fiber.NewError(fiber.StatusInternalServerError, "Cursor decoding error: "+err.Error())
}
return c.JSON(logs)
}
}