fix: mongo fail issue
This commit is contained in:
parent
503333589b
commit
bfba23bc69
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user