Skip to content

cubic3d/caddy-ct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.