configedit

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package configedit applies edits to a stored configuration: it replaces whole sections of a base configuration with typed values and runs the result through the same chain as `store import` (defaults, validation, the store secret rule and the deterministic encoding). Callers such as the admin API map their DTOs to an Edit; the merge and the field-preservation rules live here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(base []byte, edit Edit) (*config.Config, []byte, error)

Apply is ApplySpec on a stored payload, which must load.

func ApplySpec added in v0.1.13

func ApplySpec(base *config.Spec, edit Edit) (*config.Spec, *config.Config, []byte, error)

ApplySpec returns the configuration base with edit applied: what it says, what it resolves to, and its payload. The result is validated as a whole, so an edit may add a user and a budget for it at once. base is left as it is.

Types

type Edit

type Edit struct {
	Entities []config.EntitySpec
	Roles    []Role
	Users    []User
	// Settings replaces top-level sections other than datasources,
	// entities, roles and users, as decoded JSON/YAML values; a nil value
	// removes the section (its defaults apply).
	Settings map[string]any
}

Edit replaces sections of a configuration with what they say (Specs: an unset value stays unset, and takes its default when the configuration loads). A nil section keeps the base.

type Role

type Role struct {
	Name string
	config.RoleDefinitionSpec
}

Role is a named role definition.

type User

type User struct {
	Name string
	config.UserSpec
}

User is a named user, its token included: one without a token hash has none.

Jump to

Keyboard shortcuts

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