Documentation ¶
Index ¶
- func NewHandlerParametersFromLayerParams(p *config.LayerParams)
- type CommandDirHandler
- type CommandDirHandlerOption
- func WithDefaultIndexTemplateName(name string) CommandDirHandlerOption
- func WithDefaultTemplateName(name string) CommandDirHandlerOption
- func WithDevMode(devMode bool) CommandDirHandlerOption
- func WithIndexTemplateName(name string) CommandDirHandlerOption
- func WithMergeOverrideLayer(name string, layer *layers.ParsedParameterLayer) CommandDirHandlerOption
- func WithMergeOverrides(overrides *HandlerParameters) CommandDirHandlerOption
- func WithOverrideArgument(name string, value string) CommandDirHandlerOption
- func WithOverrideFlag(name string, value string) CommandDirHandlerOption
- func WithReplaceOverrideLayer(name string, layer map[string]interface{}) CommandDirHandlerOption
- func WithReplaceOverrides(overrides *HandlerParameters) CommandDirHandlerOption
- func WithRepository(r *repositories.Repository) CommandDirHandlerOption
- func WithTemplateLookup(lookup render.TemplateLookup) CommandDirHandlerOption
- func WithTemplateName(name string) CommandDirHandlerOption
- type HandlerParameters
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandlerParametersFromLayerParams ¶
func NewHandlerParametersFromLayerParams(p *config.LayerParams)
NewHandlerParametersFromLayerParams creates a new HandlerParameters from the config file. It currently requires a list of layerDefinitions in order to lookup the correct layers to stored as ParsedParameterLayer. It doesn't fail if configured layers don't exist.
TODO(manuel, 2023-05-31) Add a way to validate the fact that overrides in a config file might have a typo and don't correspond to existing layer definitions in the application.
Types ¶
type CommandDirHandler ¶
type CommandDirHandler struct { DevMode bool // TemplateName is the name of the template that is lookup up through the given TemplateLookup // used to render the glazed command. TemplateName string // IndexTemplateName is the name of the template that is looked up through TemplateLookup to render // command indexes. Leave empty to not render index pages at all. IndexTemplateName string // TemplateLookup is used to look up both TemplateName and IndexTemplateName TemplateLookup render.TemplateLookup // Repository is the command repository that is exposed over HTTP through this handler. Repository *repositories.Repository Overrides *HandlerParameters Defaults *HandlerParameters }
func NewCommandDirHandlerFromConfig ¶
func NewCommandDirHandlerFromConfig( config *config.CommandDir, options ...CommandDirHandlerOption, ) (*CommandDirHandler, error)
type CommandDirHandlerOption ¶
type CommandDirHandlerOption func(handler *CommandDirHandler)
func WithDefaultIndexTemplateName ¶
func WithDefaultIndexTemplateName(name string) CommandDirHandlerOption
func WithDefaultTemplateName ¶
func WithDefaultTemplateName(name string) CommandDirHandlerOption
func WithDevMode ¶
func WithDevMode(devMode bool) CommandDirHandlerOption
func WithIndexTemplateName ¶
func WithIndexTemplateName(name string) CommandDirHandlerOption
func WithMergeOverrideLayer ¶
func WithMergeOverrideLayer(name string, layer *layers.ParsedParameterLayer) CommandDirHandlerOption
func WithMergeOverrides ¶
func WithMergeOverrides(overrides *HandlerParameters) CommandDirHandlerOption
func WithOverrideArgument ¶
func WithOverrideArgument(name string, value string) CommandDirHandlerOption
func WithOverrideFlag ¶
func WithOverrideFlag(name string, value string) CommandDirHandlerOption
func WithReplaceOverrideLayer ¶
func WithReplaceOverrideLayer(name string, layer map[string]interface{}) CommandDirHandlerOption
func WithReplaceOverrides ¶
func WithReplaceOverrides(overrides *HandlerParameters) CommandDirHandlerOption
func WithRepository ¶
func WithRepository(r *repositories.Repository) CommandDirHandlerOption
func WithTemplateLookup ¶
func WithTemplateLookup(lookup render.TemplateLookup) CommandDirHandlerOption
func WithTemplateName ¶
func WithTemplateName(name string) CommandDirHandlerOption
type HandlerParameters ¶
type HandlerParameters struct { Layers map[string]map[string]interface{} Flags map[string]interface{} Arguments map[string]interface{} }
func NewHandlerParameters ¶
func NewHandlerParameters() *HandlerParameters
func (*HandlerParameters) Merge ¶
func (ho *HandlerParameters) Merge(other *HandlerParameters)
Merge merges the given overrides into this one. If a layer is already present, it is merged with the given one. Flags and arguments are merged, overrides taking precedence.
Click to show internal directories.
Click to hide internal directories.