Discover Packages
github.com/richtoms/mokk
config
package
Version:
v1.2.1
Opens a new window with list of versions in this module.
Published: Apr 18, 2024
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
View Source
const (
DefaultPort = "80"
DefaultHost = "127.0.0.1"
)
type Config struct {
Name string `yaml:"name"`
Options Options `yaml:"options"`
Routes []Route `yaml:"routes"`
}
LoadConfigFromFile attempts to load the config from the given file path.
type Options struct {
PrintRequestBody bool `yaml:"printRequestBody"`
TrackRequests bool `yaml:"trackRequests"`
Port string `yaml:"port"`
Host string `yaml:"host"`
}
type Route struct {
Path string `yaml:"path" json:"path"`
Method string `yaml:"method" json:"method"`
StatusCode int `yaml:"statusCode" json:"statusCode"`
Response string `yaml:"response" json:"response"`
Variants []RouteVariant `yaml:"variants,omitempty" json:"variants"`
Delay int `yaml:"delay"`
}
type RouteVariant struct {
Params map[string ]string `yaml:"params" json:"params"`
StatusCode int `yaml:"statusCode" json:"statusCode"`
Response string `yaml:"response" json:"response"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.