Settings schema (GenerateConfig)

Call GenerateConfig([...]) at addon load time to declare settings fields. Schemas are stored in app config; values live in addonsParams[id]. Defaults are merged on registration and when the settings page opens.

Field structure

Each field has:

Property Description
key Storage key in params object
type text, color, number, boolean, array, object, select, button, folder, file
pathPicker For folder / file: title, filters (file only), filename (exact basename, file only)
default Initial value
editor If present, field appears in settings UI with label, validation, etc.
options For select: { value, label? }[]
items For array: 'text' or 'number'
fields For object: nested fields
event For button: event name fired on click (handle with events.On)

Fields without editor are persisted (internal counters, tokens) but not shown in the UI.

Inline rows

Wrap multiple fields in a nested array to render them on one settings row:

GenerateConfig([
  fieldA,
  [fieldB, fieldC],
  fieldD,
]);

Supported types

Example

GenerateConfig([
  {
    key: 'api_server',
    type: 'text',
    default: 'https://example.com:2083',
    editor: {
      label: { en: 'API server', ru: 'API сервер', uk: 'API сервер' },
    },
  },
  {
    key: 'theme',
    type: 'select',
    default: 'dark',
    options: [
      { value: 'dark', label: { en: 'Dark', ru: 'Тёмная', uk: 'Темна' } },
      { value: 'light', label: { en: 'Light', ru: 'Светлая', uk: 'Світла' } },
    ],
    editor: { label: { en: 'Theme', ru: 'Тема', uk: 'Тема' } },
  },
  { key: 'last_sync', type: 'number', default: 0 },
  {
    key: 'reconnect',
    type: 'button',
    event: 'onReconnect',
    editor: { label: { en: 'Reconnect', ru: 'Переподключиться', uk: 'Перепідключитися' } },
  },
]);

events.On('onReconnect', async () => {
  // user clicked Reconnect in settings
});

Reading params

const params = await api.config.getParams();
await api.config.updateParams({ last_sync: Date.now() });

Size limit: 10 000 bytes JSON per addon unless INCREASE_CONFIG_SIZE is granted (1 000 000 bytes).