Skip to content

The Config Item

Everything Configuard does starts from a list of config items. One item is one setting — a row in a tall key / value table, carrying its own metadata.

Configuration is a long, ever-growing list of individual settings that changes across environments and over the life of a product. A tall key/value table lets you add, edit, or remove one setting at a time — each row carrying its own type, access level, options, and flags — and administer it from a UI without schema migrations. That beats wide, one-column-per-setting tables or settings scattered across files.

The cost is that flat rows are good to store, not to consume: values are strings, related keys are scattered, and the same value is often duplicated. Configuard closes that gap.

Each row implements IConfigItem:

FieldTypeMeaning
accessorAccessorTypesystem / application / all. See Access Control.
appAccessnumber | nullBitwise flags for application clients (ABAC).
keystringDot/bracket notation; a leading @ marks an option list.
typeValueTypeHow value is parsed. See Value Types.
listTypeListTypenone / array / csl. See List Types.
valuestring | nullThe raw value to parse; may contain ${...} templates.
optionsstring | nullAllowed values, or a "${@name}" option-list reference.
defaultValuestring | nullFactory value, for reverting.
requiresRebootbooleanWhether changing it requires a reboot.
editablebooleanWhether the accessor may edit it.
encryptbooleanWhether the value is encrypted at rest.
descriptionstring | nullHuman-readable description.

Configuard.isConfigItem(o) is the matching type guard.

The rows mirror a config table. A reference schema:

schema.sql
-- A vertical key → value `config` table. Each row is one setting, carrying its
-- own metadata (type, access level, options, requiresReboot, …) so settings can
-- be added, edited, or removed one at a time — no schema migrations.
CREATE TABLE `config` (
`accessor` enum('system','application','all') NOT NULL DEFAULT 'system',
`appAccess` int unsigned DEFAULT NULL, -- bitwise flags (ABAC)
`key` varchar(255) NOT NULL DEFAULT '', -- dot/bracket notation; leading `@` = option list
`type` enum('null','string','boolean','number','integer','float','hexadecimal','datetime','date','time','regexp','json','any') NOT NULL DEFAULT 'null',
`listType` enum('none','array','csl') NOT NULL DEFAULT 'none',
`value` varchar(5000) DEFAULT NULL, -- raw string; may hold `${...}` templates
`options` text DEFAULT NULL, -- allowed values, or a `${@name}` option-list ref
`defaultValue` varchar(5000) DEFAULT NULL, -- factory value, for reverting
`requiresReboot` tinyint unsigned NOT NULL DEFAULT '0',
`editable` tinyint unsigned NOT NULL DEFAULT '1',
`encrypt` tinyint unsigned NOT NULL DEFAULT '0',
`description` text DEFAULT NULL,
UNIQUE KEY `config_uniq_key` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Configuration items table.';

The value column stays a string in storage — Configuard parses it on the way out and serializes it on the way back in.

Two key shapes are treated as metadata, not as plain config values:

  • @-prefixed keys define a reusable option list (e.g. @UIColors). They are excluded from the built object.
  • Section markers — a key whose last note starts with $ (e.g. cp.config.$title) is section metadata for an admin UI, and is skipped during the build.