Concept

The Configuration

red-ale's own settings file, for what GnuCash keeps in preferences and user files, against Book options, which live in the book. Where it is, how to read and change a Setting by path, secrets, and the settings you are likely to want.

GnuCash keeps settings in two places. Preferences (Edit > Preferences) belong to the person using GnuCash and are kept outside the book. Book options (File > Properties) belong to the book and travel with it. red-ale keeps the same split.

Kept inExamplesMethods
The Configurationred-ale's own JSON settings fileAccounting period, report currency, import settings, quote services, saved report configurations, the report directoryconfig.get, config.set, config.schema, and the shortcuts period.* and docLink.setPathHead
Book optionsThe Book, as Slots GnuCash readsUse trading accounts, the auto read-only threshold, the split-action number field, the default budget, business detailsbook.options, book.setOptions, counter.*

⚠ Do not call the Configuration a "preference file of the book": it never goes into a book. A preference that GnuCash holds, such as the accounting period, is in red-ale's Configuration. GUI-only preferences (window layout, register look, the Tip of the Day) have nothing to configure.

Where it is

Every red-ale process reads one Configuration file:

Started withConfiguration
neither optionThe default file, shared by every process started this way: ~/.config/red-ale/config.json on Linux ($XDG_CONFIG_HOME/red-ale/config.json if set), ~/Library/Application Support/red-ale/config.json on macOS
--config <file>That file, for this process
--no-configMemory only, for this process: nothing is read or written

The file is read at every use, so a change made by hand or by another process takes effect at once. A change takes a lock on <file>.lock while it reads and rewrites the file, so two processes do not lose each other's changes; the file is written whole and renamed into place, and readable by its owner only.

Settings

A Setting is one value of the Configuration, named by its setting path, the keys joined with .: accountingPeriod.start, import.settings.matchThreshold, quotes.services.alphavantage.key. Paths are typed on command lines, so there is no escaping.

  • config.schema returns the JSON Schema of every setting: its type, default and description. formats such as period-bound, commodity-id and decimal are checked.
  • config.get reads one setting by path, or the whole Configuration with defaults filled in. It works with no book open. It also lists unknown keys in the file (typos, kept and ignored) and problems with values that do not match the schema.
  • config.set changes one or more by path, validated against the schema, all or none. Setting a path to null restores its default.

Example: with no book.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"config.get","params":{"path":"accountingPeriod.start"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "path": "accountingPeriod.start",
    "value": "year",
    "unknown": [],
    "problems": [],
    "configFile": null
  }
}

Command line

red-ale exec config.get '{"path":"accountingPeriod.start"}'

It prints:

{
  "path": "accountingPeriod.start",
  "value": "year",
  "unknown": [],
  "problems": [],
  "configFile": null
}

MCP tool call

Tool call:

{"name":"config.get","arguments":{"path":"accountingPeriod.start"}}

Result:

{
  "structuredContent": {
    "path": "accountingPeriod.start",
    "value": "year",
    "unknown": [],
    "problems": [],
    "configFile": null
  }
}

Some Settings are owned by other methods: saved report configurations (reports.saved) and style sheets (reports.styleSheets) change only through the report.* methods, so config.set refuses them.

Secrets and the network

A secret, such as a quote service's API key, is never shown: config.get says only {"set": true} or {"set": false}, and no key appears in a result, error, log or journal. Settings that only a person may change are refused through MCP: quotes.network, which lets quote fetches reach the network (off by default, and the only network red-ale uses), and each quote service's key and keyEnv. Changing them over JSON-RPC, the CLI or by editing the file is allowed. A key is also tied to its service's host: pointing a service at a new host clears its key.

Settings you are likely to want

SettingMeaning
accountingPeriod.start, .end, .fiscalYearEndThe accounting period (Closing the books and the accounting period)
reports.directoryWhere your own report scripts are (Report scripts)
reports.currency, reports.dateFormat, reports.weekStart, reports.reverseBalancedAccounts, reports.limits.*What reports read where GnuCash reads a preference
localeNumber, date and currency conventions (C by default, or a POSIX name such as fr_FR)
defaultCurrencyGnuCash's default currency: what currencies are quoted in
docLinks.pathHeadThe folder relative document links start from
import.settings.*, import.csvLayouts.*, import.qifAccountMapThe matcher's thresholds and saved layouts (Importing and matching)
quotes.network, quotes.services.*, quotes.sources.*Online quotes (Prices and exchange rates)

Book options

book.options reads the options kept in the book, and book.setOptions changes them as GnuCash's Book Options dialog does. An absent option is left alone.

OptionMeaning
useTradingAccountsKeep multi-currency Transactions balanced through trading Accounts (Trading accounts)
splitActionForNumUse a Split's action field as its number. Turning it on adds the Book feature Number Field Source
autoReadOnlyDaysA number of days; Transactions older than that become read-only (0 turns it off)
defaultBudgetThe Budget reports start from (Budgets)
companyName, companyAddress, companyContactPerson, companyPhoneNumber, companyFaxNumber, companyEmailAddress, companyWebsiteUrl, companyId, taxNumberThe business details the Printable Invoice prints
defaultInvoiceReportThe invoice report Print Invoice runs

Document numbers are kept separately: counters hold the last number issued for each kind of document or owner (gncInvoice, gncCustomer, ...), with a format such as %.6li. counter.list and counter.set read and change them. ⚠ GnuCash's book options call a counter the previous number: the next ID is one more.