Documentation ¶
Index ¶
- func ExperimentalEnabled(ctx context.Context) bool
- func SetExperimental(ctx context.Context) context.Context
- type Config
- func (c *Config) ApplyDefaults()
- func (c *Config) GetMode() (os.FileMode, bool, error)
- func (c *Config) MergeFrom(o *Config) *Config
- func (c *Config) ParseDataSourceFlags(datasources, contexts, templates, headers []string) error
- func (c *Config) ParsePluginFlags(plugins []string) error
- func (c *Config) String() string
- func (c Config) Validate() (err error)
- type DataSource
- type PluginConfig
- type Templates
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExperimentalEnabled ¶
Types ¶
type Config ¶
type Config struct { Stdin io.Reader `yaml:"-"` Stdout io.Writer `yaml:"-"` Stderr io.Writer `yaml:"-"` DataSources map[string]DataSource `yaml:"datasources,omitempty"` Context map[string]DataSource `yaml:"context,omitempty"` Plugins map[string]PluginConfig `yaml:"plugins,omitempty"` Templates Templates `yaml:"templates,omitempty"` // Extra HTTP headers not attached to pre-defined datsources. Potentially // used by datasources defined in the template. ExtraHeaders map[string]http.Header `yaml:"-"` // internal use only, can't be injected in YAML PostExecInput io.Reader `yaml:"-"` Input string `yaml:"in,omitempty"` InputDir string `yaml:"inputDir,omitempty"` InputFiles []string `yaml:"inputFiles,omitempty,flow"` ExcludeGlob []string `yaml:"excludes,omitempty"` OutputDir string `yaml:"outputDir,omitempty"` OutputMap string `yaml:"outputMap,omitempty"` OutputFiles []string `yaml:"outputFiles,omitempty,flow"` OutMode string `yaml:"chmod,omitempty"` LDelim string `yaml:"leftDelim,omitempty"` RDelim string `yaml:"rightDelim,omitempty"` MissingKey string `yaml:"missingKey,omitempty"` PostExec []string `yaml:"postExec,omitempty,flow"` PluginTimeout time.Duration `yaml:"pluginTimeout,omitempty"` ExecPipe bool `yaml:"execPipe,omitempty"` SuppressEmpty bool `yaml:"suppressEmpty,omitempty"` Experimental bool `yaml:"experimental,omitempty"` }
Config - configures the gomplate execution
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
ApplyDefaults - any defaults changed here should be added to cmd.InitFlags as well for proper help/usage display.
func (*Config) GetMode ¶
GetMode - parse an os.FileMode out of the string, and let us know if it's an override or not...
func (*Config) MergeFrom ¶
MergeFrom - use this Config as the defaults, and override it with any non-zero values from the other Config
Note that Input/InputDir/InputFiles will override each other, as well as OutputDir/OutputFiles.
func (*Config) ParseDataSourceFlags ¶
ParseDataSourceFlags - sets DataSources, Context, and Templates fields from the key=value format flags as provided at the command-line Unreferenced headers will be set in c.ExtraHeaders
func (*Config) ParsePluginFlags ¶
ParsePluginFlags - sets the Plugins field from the key=value format flags as provided at the command-line
type DataSource ¶
type DataSource struct { URL *url.URL `yaml:"-"` Header http.Header `yaml:"header,omitempty,flow"` }
DataSource - datasource configuration
func (DataSource) MarshalYAML ¶
func (d DataSource) MarshalYAML() (interface{}, error)
MarshalYAML - satisfy the yaml.Marshaler interface - URLs aren't well supported, and anyway we need to do some extra parsing
func (*DataSource) UnmarshalYAML ¶
func (d *DataSource) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML - satisfy the yaml.Umarshaler interface - URLs aren't well supported, and anyway we need to do some extra parsing
type PluginConfig ¶
type PluginConfig struct { Cmd string Args []string `yaml:"args,omitempty"` Timeout time.Duration `yaml:"timeout,omitempty"` Pipe bool `yaml:"pipe,omitempty"` }
func (*PluginConfig) UnmarshalYAML ¶
func (p *PluginConfig) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML - satisfy the yaml.Umarshaler interface - plugin configs can either be a plain string (to specify only the name), or a map with a name, timeout, and pipe flag.
type Templates ¶
type Templates map[string]DataSource
Templates - a map of templates. We can't just use map[string]DataSource, because we need to be able to marshal both the old (array of '[k=]v' strings) and the new (proper map) formats.
Note that templates use the DataSource type, since they have the exact same shape. TODO: get rid of this and just use map[string]DataSource once the legacy [k=]v array format is no longer supported