backendcors

package
v0.0.0-...-202847b Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package backendcors defines the backend configuration options and element slices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfigStructure

func NewConfigStructure() (element.Sections, error)

NewConfigStructure global configuration structure for this package. Used in frontend (to display the user all the settings) and in backend (scope checks and default values). See the source code of this function for the overall available sections, groups and fields.

Types

type Configuration

type Configuration struct {
	*cors.OptionFactories

	// ExposedHeaders indicates which headers are safe to expose to the
	// API of a CORS API specification. Separate via line break (\n).
	//
	// Path: net/cors/exposed_headers
	ExposedHeaders cfgmodel.StringCSV

	// AllowedOrigins is a list of origins a cross-domain request can be
	// executed from. If the special "*" value is present in the list, all
	// origins will be allowed. An origin may contain a wildcard (*) to replace
	// 0 or more characters (i.e.: http://*.domain.com). Usage of wildcards
	// implies a small performance penality. Only one wildcard can be used per
	// origin. Default value is ["*"] Separate via line break (\n).
	//
	// Path: net/cors/allowed_origins
	AllowedOrigins cfgmodel.StringCSV

	// AllowOriginRegex same as AllowedOrigins but uses a regex to
	// check for the domains.
	//
	// Path: net/cors/allow_origin_regex
	AllowOriginRegex cfgmodel.Str

	// AllowedMethods a list of methods the client is allowed to use with
	// cross-domain requests. Default value is simple methods (GET and POST)
	// Separate via line break (\n).
	//
	// Path: net/cors/allowed_methods
	AllowedMethods cfgmodel.StringCSV

	// AllowedHeaders A list of non simple headers the client is allowed
	// to use with cross-domain requests. If the special "*" value is present in
	// the list, all headers will be allowed. Default value is [] but "Origin"
	// is always appended to the list. Separate via line break (\n).
	//
	// Path: net/cors/allowed_headers
	AllowedHeaders cfgmodel.StringCSV

	// AllowCredentials Indicates whether the request can include user
	// credentials like cookies, HTTP authentication or client side SSL
	// certificates.
	//
	// Path: net/cors/allow_credentials
	AllowCredentials cfgmodel.Bool

	// OptionsPassthrough instructs preflight to let other potential next
	// handlers to process the OPTIONS method. Turn this on if your application
	// handles OPTIONS.
	//
	// Path: net/cors/options_passthrough
	OptionsPassthrough cfgmodel.Bool

	// MaxAge Indicates how long (in seconds) the results of a preflight
	// request can be cached.
	//
	// Path: net/cors/max_age
	MaxAge cfgmodel.Str
}

Configuration just exported for the sake of documentation. See fields for more information. Please call the New() function for creating a new Backend object. Only the New() function will set the paths to the fields.

func New

func New(cfgStruct element.Sections, opts ...cfgmodel.Option) *Configuration

New initializes the backend configuration models containing the cfgpath.Route variable to the appropriate entries in the storage. The argument Sections and opts will be applied to all models.

func (*Configuration) PrepareOptionFactory

func (be *Configuration) PrepareOptionFactory() cors.OptionFactoryFunc

PrepareOptionFactory creates a closure around the type Backend. The closure will be used during a scoped request to figure out the configuration depending on the incoming scope. An option array will be returned by the closure.

Jump to

Keyboard shortcuts

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