status

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 5 Imported by: 1

README

GoREST Status Plugin

CI Go Report Card License

Status check endpoint plugin for GoREST framework.

Installation

go get github.com/nicolasbonnici/gorest-status

Usage

import (
	"github.com/nicolasbonnici/gorest/pluginloader"
	statusplugin "github.com/nicolasbonnici/gorest-status"
)

func init() {
	pluginloader.RegisterPluginFactory("status", statusplugin.NewPlugin)
}
Configuration

Add to your gorest.yaml:

plugins:
  - name: status
    enabled: true

Features

  • Status check endpoint at /status
  • Database connectivity check
  • Returns HTTP 200 when healthy
  • Returns HTTP 503 when database is down
  • JSON response format

Response Format

Healthy (database configured and up):

{
  "status": "healthy",
  "database": {
    "status": "up"
  }
}

Unhealthy (database down):

{
  "status": "unhealthy",
  "database": {
    "status": "down",
    "error": "connection failed"
  }
}

Database not configured:

{
  "status": "healthy",
  "database": {
    "status": "not_configured"
  }
}

License

MIT License - see LICENSE file for details

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPlugin

func NewPlugin() plugin.Plugin

Types

type StatusPlugin

type StatusPlugin struct {
	// contains filtered or unexported fields
}

StatusPlugin provides a status check endpoint

func (*StatusPlugin) Handler

func (p *StatusPlugin) Handler() fiber.Handler

Handler returns a no-op middleware since status endpoint is set up via SetupEndpoints

func (*StatusPlugin) Initialize

func (p *StatusPlugin) Initialize(config map[string]interface{}) error

func (*StatusPlugin) Name

func (p *StatusPlugin) Name() string

func (*StatusPlugin) SetupEndpoints

func (p *StatusPlugin) SetupEndpoints(app *fiber.App) error

SetupEndpoints implements the optional EndpointSetup interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL