configedit

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 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 payload with typed values and runs the result through the same chain as `store import` (strict decoding, 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 returns the configuration base with edit applied, and its payload. The result is validated as a whole, so an edit may add a user and a budget for it at once.

Types

type Edit

type Edit struct {
	Entities []config.EntityConfig
	Roles    []Role
	Users    []User
	// Settings replaces top-level sections other than datasources,
	// entities, roles and users, as decoded JSON/YAML values.
	Settings map[string]any
}

Edit replaces sections of a configuration. A nil section keeps the base.

type Role

type Role struct {
	Name string
	config.RoleDefinition
}

Role is a named role definition.

type User

type User struct {
	Name string
	config.UserConfig
	KeepToken bool
}

User is a named user. KeepToken keeps the base user's tokenHash, so a client never needs to hold token hashes to edit a user; an explicitly empty TokenHash without KeepToken revokes the token.

Jump to

Keyboard shortcuts

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