config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExpirationTime = 30 * time.Minute
	DefaultClearTime      = 30 * time.Minute
)

Variables

View Source
var (
	ErrNoToPair   = errors.New("`to` values are not set for every `from`")
	ErrNoFromPair = errors.New("`from` values are not set for every `to`")
)

Functions

func StaticDirMappingHookFunc added in v0.1.0

func StaticDirMappingHookFunc() mapstructure.DecodeHookFunc

func StringToTimeDurationHookFunc added in v0.2.0

func StringToTimeDurationHookFunc() mapstructure.DecodeHookFunc

func URLMappingHookFunc added in v0.1.0

func URLMappingHookFunc() mapstructure.DecodeHookFunc

Types

type CacheConfig added in v0.2.0

type CacheConfig struct {
	ExpirationTime time.Duration `mapstructure:"expiration-time"`
	ClearTime      time.Duration `mapstructure:"clear-time"`
	Methods        []string      `mapstructure:"methods"`
}

func (*CacheConfig) Clone added in v0.2.0

func (c *CacheConfig) Clone() *CacheConfig

type CacheGlobs added in v0.2.0

type CacheGlobs []string

func (CacheGlobs) Clone added in v0.2.0

func (g CacheGlobs) Clone() CacheGlobs

type Mapping added in v0.1.0

type Mapping struct {
	From            string            `mapstructure:"from"`
	To              string            `mapstructure:"to"`
	Statics         StaticDirectories `mapstructure:"statics"`
	Mocks           Mocks             `mapstructure:"mocks"`
	Cache           CacheGlobs        `mapstructure:"cache"`
	Rewrites        RewriteOptions    `mapstructure:"rewrites"`
	OptionsHandling OptionsHandling   `mapstructure:"options-handling"`
}

func (*Mapping) Clone added in v0.1.0

func (m *Mapping) Clone() Mapping

type Mappings added in v0.1.0

type Mappings []Mapping

func NormaliseMappings added in v0.1.0

func NormaliseMappings(mappings Mappings, httpPort int, httpsPort int, useHTTPS bool) Mappings

func (Mappings) String added in v0.1.0

func (m Mappings) String() string

type Mock added in v0.1.0

type Mock struct {
	Path     string            `mapstructure:"path"`
	Method   string            `mapstructure:"method"`
	Queries  map[string]string `mapstructure:"queries"`
	Headers  map[string]string `mapstructure:"headers"`
	Response Response          `mapstructure:"response"`
}

func (*Mock) Clone added in v0.1.0

func (m *Mock) Clone() Mock

func (*Mock) String added in v0.2.0

func (m *Mock) String() string

type Mocks added in v0.1.0

type Mocks []Mock

func (Mocks) Clone added in v0.1.0

func (m Mocks) Clone() Mocks

type OptionsHandling added in v0.5.0

type OptionsHandling struct {
	Disabled bool              `mapstructure:"disabled"`
	Headers  map[string]string `mapstructure:"headers"`
	Code     int               `mapstructure:"code"`
}

func (*OptionsHandling) Clone added in v0.5.0

func (o *OptionsHandling) Clone() OptionsHandling

type Response added in v0.1.0

type Response struct {
	Code    int               `mapstructure:"code"`
	Headers map[string]string `mapstructure:"headers"`
	Delay   time.Duration     `mapstructure:"delay"`
	Raw     string            `mapstructure:"raw"`
	File    string            `mapstructure:"file"`
	Seed    uint64            `mapstructure:"seed"`
	Fake    *fakedata.Node    `mapstructure:"fake"`
}

func (*Response) Clone added in v0.1.0

func (r *Response) Clone() Response

func (*Response) IsFake added in v0.3.0

func (r *Response) IsFake() bool

func (*Response) IsFile added in v0.3.0

func (r *Response) IsFile() bool

func (*Response) IsRaw added in v0.3.0

func (r *Response) IsRaw() bool

type RewriteOptions added in v0.4.0

type RewriteOptions []RewritingOption

func (RewriteOptions) Clone added in v0.4.0

func (r RewriteOptions) Clone() RewriteOptions

type RewritingOption added in v0.4.0

type RewritingOption struct {
	From string `mapstructure:"from"`
	To   string `mapstructure:"to"`
	Host string `mapstructure:"host"`
}

func (RewritingOption) Clone added in v0.4.0

func (r RewritingOption) Clone() RewritingOption

type StaticDirectories added in v0.1.0

type StaticDirectories []StaticDirectory

func (StaticDirectories) Clone added in v0.1.0

type StaticDirectory added in v0.1.0

type StaticDirectory struct {
	Path  string `mapstructure:"path"`
	Dir   string `mapstructure:"dir"`
	Index string `mapstructure:"index"`
}

func (*StaticDirectory) Clone added in v0.1.0

func (s *StaticDirectory) Clone() StaticDirectory

func (*StaticDirectory) String added in v0.2.0

func (s *StaticDirectory) String() string

type UncorsConfig added in v0.1.0

type UncorsConfig struct {
	HTTPPort    int         `mapstructure:"http-port"`
	Mappings    Mappings    `mapstructure:"mappings"`
	Proxy       string      `mapstructure:"proxy"`
	Debug       bool        `mapstructure:"debug"`
	HTTPSPort   int         `mapstructure:"https-port"`
	CertFile    string      `mapstructure:"cert-file"`
	KeyFile     string      `mapstructure:"key-file"`
	CacheConfig CacheConfig `mapstructure:"cache-config"`
}

func LoadConfiguration added in v0.1.0

func LoadConfiguration(viperInstance *viper.Viper, args []string) *UncorsConfig

func (*UncorsConfig) IsHTTPSEnabled added in v0.1.0

func (c *UncorsConfig) IsHTTPSEnabled() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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