config

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package config provides the @config and @config.load directives that populate meta["config"], which OnPreprocess forwards to the compiler as a compile-time key-value map.

Typical use:

@config:strict=true
@config {
  retries: 3       :cli="r,retries"
  timeout: "10s"   :cli="t"
}
@config.load:path="nexss.yml"

Index

Constants

View Source
const ID = "config"

Variables

View Source
var ConfigDirective = core.Directive{
	Name:    "config",
	Example: "@config:strict=true\n@config {\n  retries: 3 :cli=\"r\"\n}",
	Handler: handleConfig,
}

ConfigDirective parses both the single-line form `@config:key=value` and the block form `@config { key: value, ... }`. Each pair is written to meta["config"] under its key.

View Source
var ConfigLoadDirective = core.Directive{
	Name:    "config.load",
	Example: `@config.load:path="nexss.yml"`,
	Handler: handleConfigLoad,
}

ConfigLoadDirective parses `@config.load:path="file.yml" [prefix="x"]` and flattens the loaded document into meta["config"], joining nested keys with dots.

Functions

func Bundle

func Bundle(_ map[string]string) core.Bundle

func RegisterYAMLLoader added in v0.14.0

func RegisterYAMLLoader(fn func([]byte) (map[string]any, error))

RegisterYAMLLoader installs a YAML decoder. Called from the config_yaml bundle's init. Idempotent; later registrations win.

Types

This section is empty.

Jump to

Keyboard shortcuts

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