Skip to main content

Node Configuration

linkiir.config

Read the current node's configuration fields. Values come from the config fields set on the node in the Node Parameters panel, flattened into a single label → value table. Password fields are decrypted automatically. The result is cached for the lifetime of the script VM: the first call reads and parses the configuration, every later call returns the same table with no I/O.


linkiir.config.node

function

linkiir.config.node()

Return this node's configuration as a label → value table.

Reads the current node's configuration and returns a flat table keyed by each config entry's label. Strings, numbers, and booleans map straight across. Labels that are absent, null, or hold an object or array read as nil. The table is cached per script VM: the configuration is read once, and every later call returns that same table.

Usage

local Cfg = linkiir.config.node()

Returns

  • table — flat map of config label → value (string, number, or boolean); empty when the node has no config fields.

Errors

Raises a Lua error when the node directory is not configured, when the node's configuration is missing or unreadable, when it is malformed, or when a password field cannot be decrypted (typically a missing or wrong LINKIIR_SECRET_KEY).

Example

local Cfg = linkiir.config.node()

local Host = Cfg.host -- "10.0.0.1"
local Port = Cfg.port -- 2575 (number)
local UseSsl = Cfg.use_ssl -- true (boolean)
local Password = Cfg.password -- decrypted plaintext

local Sock, Err = linkiir.link.socket.connect{ host = Host, port = Port }
if not Sock then
linkiir.log.error('connect failed: ' .. tostring(Err))
return
end
-- Absent fields are nil, so defaults are a plain 'or'.
local Cfg = linkiir.config.node()
local Timeout = Cfg.timeout_ms or 5000

if Cfg.protocol == 'hl7' then
linkiir.log.info('Using HL7 profile')
end
-- Cached: the second call does no disk I/O and returns the same table.
local A = linkiir.config.node()
local B = linkiir.config.node()
assert(rawequal(A, B))