class

ConfigInitializer

Inherits Reference < Object

Constants

CSV_CONFIG_KEYS = ["exclude_path", "exclude_codes", "techs", "only_techs", "exclude_techs", "use_taggers", "fail_on", "ai_context_features", "ai_native_tools_allowlist"] of ::String

Keys stored as one comma-separated String, because the CLI flags that feed them accumulate into that shape. A YAML sequence is the natural spelling for a list of globs or tech names — and base: / probe_header: in the same file are sequences — so accept it and join. Untreated, exclude_path: ["*.py"] stringified to Crystal's array inspect (["*.py"]), matched no file and excluded nothing silently; the tech keys at least failed loudly, but with that same inspect string quoted back at the user.

LEGACY_CONFIG_KEY_MAP = {"send_req" => "probe", "send_proxy" => "probe_via", "send_es" => "export_es", "send_with_headers" => "probe_header", "use_matchers" => "probe_match", "use_filters" => "probe_skip"}

v0 config-key → v1 config-key map. Applied during read_config so a ~/.config/noir/config.yaml written by v0.x with the old deliver/probe keys still loads under v1 without surprises. Mirrors the LEGACY CLI flag aliases in src/options.cr.

Constructors

new(override_path : String | Nil = nil)

override_path is the value of CLI --config-file PATH. When present, ConfigInitializer reads from that file instead of $NOIR_HOME/config.yaml. This makes --config-file flow through the same path as the default config — defaults < file < CLI — so a base: (or any other key) declared in the user's custom config file is actually applied. Pre-fix the --config-file PATH value was only used by validation and a post-CLI merge inside NoirRunner that re-overwrote everything the CLI had just set.

Source

Class methods

unknown_key_warnings(keys : Array(String), known : Array(String)) : Array(String)

One warning per key that is not a config key, with the closest real key as a hint when there is one.

Source

Instance methods

default_concurrency

Default concurrency scales with the host's CPU count, clamped to a safe window. The lower bound of 4 keeps low-core CI runners from serializing on a single worker; the upper bound of 32 keeps channel-synchronisation overhead and (under MT) GC pressure in check on very large boxes.

NOIR_CONCURRENCY lets container/CI pipelines pin the worker count to the pod's CPU allocation without threading a flag through every noir invocation. Precedence: --concurrency > NOIR_CONCURRENCY > config concurrency: > this CPU-derived default. The env step is re-applied after the file merge in read_config, since this method only seeds the defaults the file overwrites.

Source
default_options
Source
env_concurrency

A valid (>= 1) NOIR_CONCURRENCY, or nil.

Source
generate_config_file
Source
read_config
Source
setup
Source