package zddc import ( _ "embed" "sync" ) // defaultsBytes is the embedded baseline .zddc — see defaults.zddc.yaml // for the source-of-truth and a description of its role in the cascade. // //go:embed defaults.zddc.yaml var defaultsBytes []byte // EmbeddedDefaultsBytes returns the raw embedded defaults YAML. // // Surface: the show-defaults CLI subcommand dumps these bytes to // stdout so operators can copy them into /.zddc and edit. func EmbeddedDefaultsBytes() []byte { out := make([]byte, len(defaultsBytes)) copy(out, defaultsBytes) return out } var ( embeddedDefaultsOnce sync.Once embeddedDefaults ZddcFile embeddedDefaultsErr error ) // EmbeddedDefaults returns the parsed embedded defaults ZddcFile, // memoised. Parse errors surface on the first call and are sticky. // // The cascade walker (EffectivePolicy) consults this as the bottom- // most level unless an on-disk .zddc up the chain sets `inherit: false`. func EmbeddedDefaults() (ZddcFile, error) { embeddedDefaultsOnce.Do(func() { embeddedDefaults, embeddedDefaultsErr = parseBytes(defaultsBytes) }) return embeddedDefaults, embeddedDefaultsErr }