config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 URLMappingHookFunc added in v0.1.0

func URLMappingHookFunc() mapstructure.DecodeHookFunc

func Validate added in v0.1.0

func Validate(config *UncorsConfig) error

Types

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"`
}

func (*Mapping) Clone added in v0.1.0

func (u *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, httpsPort int, useHTTPS bool) (Mappings, error)

func (Mappings) String added in v0.1.0

func (mappings 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

type Mocks added in v0.1.0

type Mocks []Mock

func (Mocks) Clone added in v0.1.0

func (m Mocks) Clone() Mocks

type Response added in v0.1.0

type Response struct {
	Code    int               `mapstructure:"code"`
	Headers map[string]string `mapstructure:"headers"`
	Raw     string            `mapstructure:"raw"`
	File    string            `mapstructure:"file"`
	Delay   time.Duration     `mapstructure:"delay"`
}

func (*Response) Clone added in v0.1.0

func (r *Response) Clone() Response

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

type UncorsConfig added in v0.1.0

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

func LoadConfiguration added in v0.1.0

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

func (*UncorsConfig) IsHTTPSEnabled added in v0.1.0

func (config *UncorsConfig) IsHTTPSEnabled() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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