Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(w io.Writer, config Config, options *BuildOptions) error
Build creates an NGINX config from a crossplane.Config.
func BuildFiles ¶
func BuildFiles(payload Payload, dir string, options *BuildOptions) error
BuildFiles builds all of the config files in a crossplane.Payload and writes them to disk.
Types ¶
type BuildOptions ¶
type Config ¶
type Config struct {
File string `json:"file"`
Status string `json:"status"`
Errors []ConfigError `json:"errors"`
Parsed []Directive `json:"parsed"`
}
type ConfigError ¶
type Directive ¶
type Directive struct {
Directive string `json:"directive"`
Line int `json:"line"`
Args []string `json:"args"`
Includes *[]int `json:"includes,omitempty"`
Block *[]Directive `json:"block,omitempty"`
Comment *string `json:"comment,omitempty"`
}
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
func (ParseError) Error ¶
func (e ParseError) Error() string
type ParseOptions ¶
type ParseOptions struct {
// If true, parsing will stop immediately if an error is found.
StopParsingOnError bool
// An array of directives to skip over and not include in the payload.
IgnoreDirectives []string
// If true, include directives are used to combine all of the Payload's
// Config structs into one.
CombineConfigs bool
// If true, only the config file with the given filename will be parsed
// and Parse will not parse files included files.
SingleFile bool
// If true, comments will be parsed and added to the resulting Payload.
ParseComments bool
// If true, add an error to the payload when encountering a directive that
// is unrecognized. The unrecognized directive will not be included in the
// resulting Payload.
ErrorOnUnknownDirectives bool
// If true, checks that directives are in valid contexts.
SkipDirectiveContextCheck bool
// If true, checks that directives have a valid number of arguments.
SkipDirectiveArgsCheck bool
// If an error is found while parsing, it will be passed to this callback
// function. The results of the callback function will be set in the
// PayloadError struct that's added to the Payload struct's Errors array.
ErrorCallback func(error) interface{}
// If specified, use this alternative to open config files
Open func(path string) (io.Reader, error)
}
ParseOptions determine the behavior of an NGINX config parse.
type Payload ¶
type Payload struct {
Status string `json:"status"`
Errors []PayloadError `json:"errors"`
Config []Config `json:"config"`
}
type PayloadError ¶
Click to show internal directories.
Click to hide internal directories.