Documentation ¶
Index ¶
- type Command
- type CommandDir
- type Config
- type DefaultRendererOptions
- type Defaults
- type LayerParams
- type Route
- func (r *Route) HandlesCommand() bool
- func (r *Route) HandlesStatic() bool
- func (r *Route) HandlesTemplate() bool
- func (r *Route) IsCommandDirRoute() bool
- func (r *Route) IsCommandRoute() bool
- func (r *Route) IsStaticFileRoute() bool
- func (r *Route) IsStaticRoute() bool
- func (r *Route) IsTemplateDirRoute() bool
- func (r *Route) IsTemplateRoute() bool
- type RouteHandlerConfiguration
- type Static
- type StaticFile
- type Template
- type TemplateDir
- type TemplateLookupConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { File string `yaml:"file"` TemplateName string `yaml:"templateName"` AdditionalData map[string]interface{} `yaml:"additionalData,omitempty"` Defaults *LayerParams `yaml:"defaults,omitempty"` Overrides *LayerParams `yaml:"overrides,omitempty"` }
func (*Command) ExpandPaths ¶
type CommandDir ¶
type CommandDir struct { Repositories []string `yaml:"repositories"` IncludeDefaultRepositories *bool `yaml:"includeDefaultRepositories"` TemplateLookup *TemplateLookupConfig `yaml:"templateLookup,omitempty"` TemplateName string `yaml:"templateName,omitempty"` IndexTemplateName string `yaml:"indexTemplateName,omitempty"` AdditionalData map[string]interface{} `yaml:"additionalData,omitempty"` Defaults *LayerParams `yaml:"defaults,omitempty"` Overrides *LayerParams `yaml:"overrides,omitempty"` }
func (*CommandDir) ExpandPaths ¶
func (c *CommandDir) ExpandPaths() error
type Config ¶
type Config struct { Routes []*Route `yaml:"routes"` Defaults *Defaults `yaml:"defaults,omitempty"` }
func ParseConfig ¶
func (*Config) Initialize ¶ added in v0.3.2
type DefaultRendererOptions ¶ added in v0.3.2
type DefaultRendererOptions struct { UseDefaultParkaRenderer *bool `yaml:"useDefaultParkaRenderer,omitempty"` // TODO(manuel, 2023-06-21) These two options are not implemented yet // It is not so much that they are hard to implement, but rather that they are annoying to test. // See: https://github.com/go-go-golems/parka/issues/56 TemplateDirectory string `yaml:"templateDirectory,omitempty"` MarkdownBaseTemplateName string `yaml:"markdownBaseTemplateName,omitempty"` }
DefaultRendererOptions controls the default renderer. If UseDefaultParkaRenderer is true, the default parka renderer will be used. It renders markdown files using base.tmpl.html and uses a tailwind css stylesheet which has to be served under dist/output.css.
type Defaults ¶ added in v0.3.2
type Defaults struct { Renderer *DefaultRendererOptions `yaml:"renderer,omitempty"` UseParkaStaticFiles *bool `yaml:"useParkaStaticFiles,omitempty"` }
Defaults controls the default renderer and which embedded static files to serve.
type LayerParams ¶
type LayerParams struct { Layers map[string]map[string]interface{} `yaml:"layers,omitempty"` Flags map[string]interface{} `yaml:"flags,omitempty"` Arguments map[string]interface{} `yaml:"arguments,omitempty"` }
func NewLayerParams ¶
func NewLayerParams() *LayerParams
func (*LayerParams) Merge ¶
func (p *LayerParams) Merge(overrides *LayerParams)
Merge merges the two LayerParams, with the overrides taking precedence. It merges all the layers, flags, and arguments. For each layer, the layer flags are merged as well, overrides taking precedence.
type Route ¶
type Route struct { Path string `yaml:"path"` CommandDirectory *CommandDir `yaml:"commandDirectory,omitempty"` Command *Command `yaml:"command,omitempty"` Static *Static `yaml:"static,omitempty"` StaticFile *StaticFile `yaml:"staticFile,omitempty"` TemplateDirectory *TemplateDir `yaml:"templateDirectory,omitempty"` Template *Template `yaml:"template,omitempty"` }
Route represents a single sub-route of the server. Only one of the booleans or one of the pointers should be true or non-nil. This is the first attempt at the structure of a config file, and is bound to change.
func (*Route) HandlesCommand ¶
func (*Route) HandlesStatic ¶
func (*Route) HandlesTemplate ¶
func (*Route) IsCommandDirRoute ¶
func (*Route) IsCommandRoute ¶
func (*Route) IsStaticFileRoute ¶
func (*Route) IsStaticRoute ¶
func (*Route) IsTemplateDirRoute ¶
func (*Route) IsTemplateRoute ¶
type RouteHandlerConfiguration ¶
type RouteHandlerConfiguration interface { // ExpandPaths() error }
RouteHandlerConfiguration is the interface that all route handler configurations must implement. By RouteHandlerConfiguration, we mean things like CommandDir, Command, Static, etc...
type Static ¶
type Static struct {
LocalPath string `yaml:"localPath"`
}
func (*Static) ExpandPaths ¶
type StaticFile ¶
type StaticFile struct {
LocalPath string `yaml:"localPath"`
}
func (*StaticFile) ExpandPaths ¶
func (s *StaticFile) ExpandPaths() error
type Template ¶
type Template struct { // every request will be rendered from the template file, using the default renderer in the case of markdown // content. TemplateFile string `yaml:"templateFile"` AdditionalData map[string]interface{} `yaml:"additionalData,omitempty"` }
func (*Template) ExpandPaths ¶
type TemplateDir ¶
type TemplateDir struct { LocalDirectory string `yaml:"localDirectory"` IndexTemplateName string `yaml:"indexTemplateName,omitempty"` AdditionalData map[string]interface{} `yaml:"additionalData,omitempty"` }
TemplateDir serves a directory of html, md, .tmpl.md, .tmpl.html files. Markdown files are renderer using the given MarkdownBaseTemplateName, which will be looked up in the TemplateDir itself, or using the default renderer if empty.
func (*TemplateDir) ExpandPaths ¶
func (t *TemplateDir) ExpandPaths() error
type TemplateLookupConfig ¶ added in v0.3.2
type TemplateLookupConfig struct { // Directories is a list of directories that will be searched for templates. Directories []string `yaml:"directories,omitempty"` // Patterns is a list of glob patterns that will be used to match files in the directories. // If the list is empty, the default of **/*.tmpl.md and **/*.tmpl.html will be used Patterns []string `yaml:"patterns,omitempty"` }
TemplateLookupConfig is used to configured a directory based template lookup.