Documentation
¶
Overview ¶
Package settings defines every Flow-I setting, parses values, and resolves them across layers (built-in default → user → workspace → collection → folder → request → node → environment variable → flag).
It is the only package that reads process environment variables.
Index ¶
- func Editor(environ []string) string
- func EnvVarName(key string) string
- func ParseRate(s string) (time.Duration, error)
- func ParseValue(k Key, raw any) (any, error)
- func ProcessEnviron() []string
- func ProxyConfig(proxySetting string, environ []string) *httpproxy.Config
- type Key
- type Kind
- type Layer
- type LayerValues
- type Paths
- type Resolved
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Editor ¶
Editor returns the user's editor command: $VISUAL, then $EDITOR, then a platform default.
func EnvVarName ¶
EnvVarName returns the environment variable that overrides a key.
func ParseRate ¶
ParseRate reads a rate limit such as "20/s", "120/m" or "5/h" and returns the interval between two calls at that rate.
func ParseValue ¶
ParseValue converts a raw value from YAML (string, bool, int64, []any) or from an environment variable (always string) into the key's type: string, bool, int64, time.Duration or []string.
func ProcessEnviron ¶
func ProcessEnviron() []string
ProcessEnviron returns the process environment. It is the module's only direct access to environment variables; callers pass the result down.
func ProxyConfig ¶
ProxyConfig decides which proxy outgoing requests use. A non-empty proxy.http setting is used for both HTTP and HTTPS. Otherwise the conventional HTTP_PROXY, HTTPS_PROXY and NO_PROXY variables (or their lower-case forms) are read from environ, so a machine's usual proxy setup works without Flow-I-specific configuration. NO_PROXY applies in both cases.
Types ¶
type Key ¶
type Key struct {
Name string
Description string
Kind Kind
Default any
Enum []string
Min, Max int64 // KindInt bounds; Max 0 means unbounded
FileLayers []Layer
}
Key describes one setting. Env and flag layers may always set a key; FileLayers lists which file layers may.
type Layer ¶
type Layer int
Layer is where a value came from. Higher layers win.
type LayerValues ¶
LayerValues are the validated values one layer sets. Source names the file or variable they came from.
func FromBlock ¶
func FromBlock(schema []Key, layer Layer, source string, raw map[string]any) (LayerValues, diag.List)
FromBlock validates a flattened settings block read from a file at the given layer. Unknown keys warn and are dropped; invalid values and keys not allowed at the layer are errors. Diagnostic paths point into the file: "$.<key>" for the user settings file, "$.settings.<key>" elsewhere.
func FromEnviron ¶
func FromEnviron(schema []Key, environ []string) (LayerValues, diag.List)
FromEnviron reads FLOWI_* overrides from an environ slice ("K=V"). Unknown FLOWI_ variables warn, so typos do not pass silently.
type Paths ¶
type Paths struct {
ConfigDir string
}
Paths are the directories Flow-I keeps its own files in.
func DiscoverPaths ¶
DiscoverPaths returns FLOWI_CONFIG_DIR if set, otherwise os.UserConfigDir()/flowi.
type Resolved ¶
type Resolved struct {
// contains filtered or unexported fields
}
Resolved holds every layer for lookup and explanation.
func Resolve ¶
func Resolve(schema []Key, layers ...LayerValues) Resolved
Resolve combines layers; their order in the call does not matter. Built-in defaults are always the lowest layer.