ct

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 14 Imported by: 0

README

Container Linux Config Transpiler for Caddy

The caddy-ct module for Caddy allows to transpile YAML based configuration into a JSON ignition to be used with Flatcar or Fedora CoreOS.

It targets to replace Matchbox with an open and flexible approach of templating, matching and providing metadata using Caddy's templates for static configurations (no API for terraform).

Configuration

ct [<matcher>] {
  strict
  mime <MIMEType> [<MIMEType...>]
  platform <platformName>
}

All options are optional:

  • matcher according to matcher
  • strict fail on non critical errors (default: false)
  • mime only transpile specific MIME types (default: all)
  • platform only for dynamic data must be one of those (default: none)

The module is unordered by default and needs to be ordered using the global option

{
    order ct before templates
}

or be used inside a route block.

Example Caddyfile

The following example allows files with specific MIME types to be templated and transpiled after to ignition config.

{
  order ct before templates
}

:8080 {
  log
  respond / "OK"
  file_server
  templates {
    mime text/html text/plain application/json application/x-yaml
    between [[ ]]
  }
  ct {
    strict
    mime application/x-yaml
  }
}

Building

See xcaddy, short:

xcaddy build \
  --with github.com/cubic3d/caddy-ct

or download from https://caddyserver.com/download by selecting this module.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ct

type Ct struct {

	// Fail on non critical errors (default: false)
	Strict bool `json:"strict,omitempty"`
	// Only transpile specific MIME types (default: all)
	MIMETypes []string `json:"mime_types,omitempty"`
	// Only for dynamic data must be one of supported types by ct (default: none)
	Platform string `json:"platform,omitempty"`
	// contains filtered or unexported fields
}

Ct allows to transpile YAML based configuration into a JSON ignition to be used with Flatcar or Fedora CoreOS.

func (Ct) CaddyModule

func (Ct) CaddyModule() caddy.ModuleInfo

func (*Ct) Provision

func (ct *Ct) Provision(ctx caddy.Context) error

func (Ct) ServeHTTP

func (ct Ct) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

func (*Ct) UnmarshalCaddyfile

func (ct *Ct) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

func (*Ct) Validate

func (ct *Ct) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL