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 2 classes

Entity Profile

Dependency Diagram

graph LR
  57f193e8_19f3_5c5f_1b14_fb6e19f8db2a["config.go"]
  fcef1725_af89_d6cd_36cd_b228cdcc5acd["errors"]
  57f193e8_19f3_5c5f_1b14_fb6e19f8db2a --> fcef1725_af89_d6cd_36cd_b228cdcc5acd
  style 57f193e8_19f3_5c5f_1b14_fb6e19f8db2a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package idempotency

import (
	"errors"
	"fmt"
	"time"

	"github.com/gofiber/fiber/v3"
	"github.com/gofiber/fiber/v3/internal/storage/memory"
)

var ErrInvalidIdempotencyKey = errors.New("invalid idempotency key")

// Config defines the config for middleware.
type Config struct {
	// Lock locks an idempotency key.
	//
	// Optional. Default: an in-memory locker for this process only.
	Lock Locker

	// Storage stores response data by idempotency key.
	//
	// Optional. Default: an in-memory storage for this process only.
	Storage fiber.Storage

	// Next defines a function to skip this middleware when returned true.
	//
	// Optional. Default: a function which skips the middleware on safe HTTP request method.
	Next func(c fiber.Ctx) bool

	// KeyHeaderValidate defines a function to validate the syntax of the idempotency header.
	//
	// Optional. Default: a function which ensures the header is 36 characters long (the size of an UUID).
	KeyHeaderValidate func(string) error

	// KeyHeader is the name of the header that contains the idempotency key.
	//
	// Optional. Default: X-Idempotency-Key
	KeyHeader string

	// KeepResponseHeaders is a list of headers that should be kept from the original response.
	//
	// Optional. Default: nil (to keep all headers)
	KeepResponseHeaders []string

	// Lifetime is the maximum lifetime of an idempotency key.
	//
	// Optional. Default: 30 * time.Minute
	Lifetime time.Duration

	// DisableValueRedaction turns off masking idempotency keys in logs and errors when set to true.
	//
	// Optional. Default: false
	DisableValueRedaction bool
}

// ConfigDefault is the default config
var ConfigDefault = Config{
	Next: func(c fiber.Ctx) bool {
		// Skip middleware if the request was done using a safe HTTP method
// ... (73 more lines)

Domain

Subdomains

Types

Dependencies

  • errors

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, error.
What does config.go depend on?
config.go imports 1 module(s): errors.
Where is config.go in the architecture?
config.go is located at middleware/idempotency/config.go (domain: FiberCore, subdomain: Adapters, directory: middleware/idempotency).

Analyze Your Own Codebase

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

Try Supermodel Free