ctl

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package ctl holds the config-driven machinery layered onto the shipped jenticctl installer (impl/6.0): the embedded backend config schema, the defaults<preset<flags precedence ladder, and the overlay that merges the resolved settings into the generated jentic-one.yaml. It is additive — the mature install.Draft/RunWizard flow is preserved; these are the schema-driven --section-field flags and presets that sit on top of it (plan.md Phase 6).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeSettings

func MergeSettings(dst, src Settings)

MergeSettings deep-merges src into dst: nested maps recurse (so a preset that names one leaf of a section does not wipe the section's other defaulted leaves), scalars overwrite. This is what produces the layered precedence without any per-field copying.

func OverlaySettings

func OverlaySettings(original []byte, settings Settings) ([]byte, error)

OverlaySettings merges the resolved installer settings into an existing jentic-one.yaml document, returning the re-serialised bytes. It operates on the yaml.Node tree rather than round-tripping through a typed struct so it PRESERVES what the OSS BackendConfig schema cannot describe: enterprise overlay extension sections (e.g. embeddings:) and operator comments in a hand-edited file (impl/6.0 §4, same posture as config.MutateConfig, impl/1.3 §2). A struct-based rewrite would silently delete both.

Only the leaves the settings name are set; every other key (known or unknown) in the original document is left byte-for-byte intact. Settings values are mapped onto YAML scalar/mapping nodes; nested settings recurse into (creating, if absent) the matching mapping node.

func Presets

func Presets() []string

Presets returns the names of the embedded presets, for help text and validation.

func SchemaBytes

func SchemaBytes() ([]byte, error)

SchemaBytes returns the embedded config schema (for the binder/form which read titles/descriptions/defaults from the same document).

func SensitivePaths

func SensitivePaths() (map[string]bool, error)

SensitivePaths returns the set of dotted config paths (server.public_base_url style) whose leaves carry a secret, derived from the embedded schema: a leaf is sensitive if the schema marks it writeOnly or format=password (Pydantic emits both for SecretStr), or the secret-name heuristic matches AND the hit is classified as a real secret (or not yet classified — fail-closed) in heuristicClassified. The installer excludes these from the generated --<section>-<field> flags: credentials belong in the wizard's secret-generation/.env flow, never on a command line where they land in `ps`, shell history, and --help (impl/6.0; same fail-closed posture as the ux redactor).

func UnclassifiedSensitiveNames

func UnclassifiedSensitiveNames() ([]string, error)

UnclassifiedSensitiveNames returns the schema leaves the name heuristic matched that have neither a schema marker nor a heuristicClassified entry. Runtime treats them as sensitive (fail-closed); the arch test pins this list to empty so every hit is consciously classified.

Types

type Settings

type Settings map[string]any

Settings is the resolved configuration as a nested map (section → key → value), the currency of the precedence ladder. We work in map space rather than the typed BackendConfig because the generated struct's UnmarshalJSON enforces the schema's required sections (databases and its sub-DBs), which a *partial* defaults/preset/flag layer legitimately omits — merging maps sidesteps that while still producing exactly the nested shape the YAML overlay wants (impl/6.0 §3.5). The typed struct is used only by the binder/form to ENUMERATE flags (a zero value suffices there), never as the merge currency.

func PresetSettings

func PresetSettings(name string) (Settings, error)

PresetSettings returns the named embedded preset as a nested map. Unknown preset => loud error.

func ResolveSettings

func ResolveSettings(preset string, flagOverrides Settings) (Settings, error)

ResolveSettings applies the precedence ladder (schema defaults < preset < explicit flag overrides, impl/6.0 §3.5) entirely in map space and returns the merged nested settings, ready to overlay onto the generated jentic-one.yaml. flagOverrides is the nested map the binder produced from the operator's explicitly-set --section-field flags (only set leaves; may be nil).

Directories

Path Synopsis
Package generated holds the backend configuration struct generated by go-jsonschema from the vendored config schema (config.go, regenerated via `make generate-config`), plus a hand-written stable alias (this file).
Package generated holds the backend configuration struct generated by go-jsonschema from the vendored config schema (config.go, regenerated via `make generate-config`), plus a hand-written stable alias (this file).

Jump to

Keyboard shortcuts

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