Home / File/ config.go — fiber Source File

config.go — fiber Source File

Architecture documentation for config.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberCore Adapters 1 imports 3 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  c109343c_0648_ab9d_92d7_bec27908972f["config.go"]
  6604ba6b_bab7_17c7_e687_7d0f07080e5a["v3"]
  c109343c_0648_ab9d_92d7_bec27908972f --> 6604ba6b_bab7_17c7_e687_7d0f07080e5a
  style c109343c_0648_ab9d_92d7_bec27908972f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package healthcheck

import (
	"github.com/gofiber/fiber/v3"
)

// Config defines the configuration options for the healthcheck middleware.
type Config struct {
	// Next defines a function to skip this middleware when returned true. If this function returns true
	// and no other handlers are defined for the route, Fiber will return a status 404 Not Found, since
	// no other handlers were defined to return a different status.
	//
	// Optional. Default: nil
	Next func(fiber.Ctx) bool

	// Probe is executed to determine the current health state. It can be used for liveness,
	// readiness or startup checks. Returning true indicates the application is healthy.
	//
	// Optional. Default: func(c fiber.Ctx) bool { return true }
	Probe func(fiber.Ctx) bool
}

const (
	// LivenessEndpoint is the conventional path for a liveness check.
	// Register the middleware on this path to expose it.
	LivenessEndpoint = "/livez"

	// ReadinessEndpoint is the conventional path for a readiness check.
	// Register the middleware on this path to expose it.
	ReadinessEndpoint = "/readyz"

	// StartupEndpoint is the conventional path for a startup check.
	// Register the middleware on this path to expose it.
	StartupEndpoint = "/startupz"
)

func defaultProbe(_ fiber.Ctx) bool { return true }

// ConfigDefault is the default configuration.
var ConfigDefault = Config{
	Next:  nil,
	Probe: defaultProbe,
}

func configDefault(config ...Config) Config {
	if len(config) < 1 {
		return ConfigDefault
	}

	cfg := config[0]

	if cfg.Probe == nil {
		cfg.Probe = ConfigDefault.Probe
	}

	return cfg
}

Domain

Subdomains

Classes

Types

Dependencies

  • v3

Frequently Asked Questions

What does config.go do?
config.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Adapters subdomain.
What functions are defined in config.go?
config.go defines 3 function(s): bool, configDefault, defaultProbe.
What does config.go depend on?
config.go imports 1 module(s): v3.
Where is config.go in the architecture?
config.go is located at middleware/healthcheck/config.go (domain: FiberCore, subdomain: Adapters, directory: middleware/healthcheck).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free