readonly

package
v0.0.0-...-e5e1318 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultConfig default readonly config
	DefaultConfig = Config{
		ReadOnly: func(r *http.Request) bool {
			return config.ReadOnly(r.Context())
		},
	}
)

Functions

func Middleware

func Middleware(skippers ...middleware.Skipper) func(http.Handler) http.Handler

Middleware middleware reject request when harbor set to readonly with default config

func MiddlewareWithConfig

func MiddlewareWithConfig(config Config, skippers ...middleware.Skipper) func(http.Handler) http.Handler

MiddlewareWithConfig middleware reject request when harbor set to readonly with config

Types

type Config

type Config struct {
	// ReadOnly defines a function to check whether is readonly mode for request
	ReadOnly func(*http.Request) bool
}

Config defines the config for ReadOnly middleware.

Jump to

Keyboard shortcuts

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