caddyfile

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package caddyfile lexes and parses Caddyfiles for the caddy plugin (routes) and the env plugin (the {$VAR} names a Caddyfile reads), https://cernly.dev/how/plugins/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	Name string
	Line int
}

Env is an environment variable a Caddyfile reads, and the line it is on.

func EnvNames

func EnvNames(src []byte) ([]Env, error)

EnvNames returns the environment variables a Caddyfile reads, in token order. Comments are not tokens, so a name in a comment is not read.

type Node

type Node struct {
	Args  []Token
	Block []Node
	Open  bool // ended with {, Block holds its contents
}

node is one line of a Caddyfile, the tokens of a directive or of a site's addresses, with the block that follows it.

func Parse

func Parse(toks []Token) ([]Node, error)

parse splits the tokens into lines and nests the { } blocks.

func (Node) At

func (n Node) At() fact.Evidence

at is the node's evidence: its file and line.

func (Node) Line

func (n Node) Line() int

func (Node) Name

func (n Node) Name() string

type Token

type Token struct {
	Text   string
	Line   int
	Quoted bool   // written in quotes: never a block delimiter
	Body   int    // a heredoc's first body line; Line is its <<MARKER line
	File   string // the file it was read from, set after lexing (imports mix files)
}

func Lex

func Lex(src []byte) ([]Token, error)

Jump to

Keyboard shortcuts

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