caddyfile_ext

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0, MIT Imports: 4 Imported by: 0

README

🍭 caddyfile-ext

Extends your Caddyfile with additional JSON configuration.

✍️ Example

{
	app1 example {
		# set value of a field
		# > "field": "whatever"
		field whatever

		# value is first converted to a scalar type
		# > "boolean": true
		# > "number": 123.45
		boolean true
		number 123.45

		# quoted value is always a string
		# > "string": "false"
		stirng "false"

		# multiple arguments are considered as a path to update a value
		# > "a": {
		# >		"b": {
		# >			"c": {
		# >				"k1": "v1",
		# >				"k2": "v2"
		# >			}
		# >		}
		# > }
		a b c {
			k1 v2
			k2 v1
		}

		# key starts with '+' represents an array
		# > "arr": [1, 2]
		+arr 1
		+arr 2

		# '+' is available in a path to create a single-element array
		# > "obj": {
		# >		"arr": [{
		# >			"key": "val"
		# >		}]
		# > }
		obj +arr key val
	}

	# create a layer4 App
	app2 layer4 servers main {
		+listen :7443
		+routes {
			+match tls +sni xx.example.com
			+handle {
				handler proxy
				+upstreams +dial :7441
			}
		}
		+routes {
			+match tls +sni yy.example.com
			+handle {
				handler proxy
				+upstreams +dial :7442
			}
		}
		+routes {
			+handle {
				handler proxy
				+upstreams +dial :7443
			}
		}
	}
}

⚖️ License

Licensed under either of

at your option.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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