Skip to main content

JSON-LD configuration

[jsonld]​

How @context documents are resolved.

[[jsonld.preloaded_contexts]]​

Contexts read from files at startup, one [[jsonld.preloaded_contexts]] table each with its url and path. Set in the file only. Left out, no context is preloaded.
# [[jsonld.preloaded_contexts]]
# url = "https://example.org/ngsi-ld/context.jsonld"
# path = "contexts/example.jsonld"

jsonld.preloaded_contexts.url​

URLrestart to apply

The URL the context is known by. A preloaded URL is never downloaded.

Required
Yes. Example: "https://example.org/ngsi-ld/context.jsonld"
Also required
  • No two preloaded contexts name the same URL.

jsonld.preloaded_contexts.path​

pathrestart to apply

The file the context is read from, which must exist and hold a valid @context document. A relative path that does not resolve from the working directory is read relative to the configuration file's directory.

Required
Yes. Example: "contexts/example.jsonld"

[jsonld.fetch]​

Whether and how a remote @context is downloaded.
[jsonld.fetch]
mode = "enabled"
timeout = "10s"
max_redirects = 5
max_size = "2 MiB"
private_addresses = "allowed"
allowed_addresses = []
denied_addresses = []

jsonld.fetch.mode​

stringrestart to apply

Whether a context that is neither embedded, preloaded, stored nor cached may be downloaded. With "disabled" nothing is downloaded: only the core @context and the W3C Data Integrity context it names, preloaded documents, stored @contexts and what is already cached are used.

Default
"enabled"
Allowed values
"disabled"Turn the feature off.
"enabled"Turn the feature on.
Environment variable
ANDROMEDA__JSONLD__FETCH__MODE

jsonld.fetch.timeout​

durationrestart to apply

How long one download may take, its redirects included. A download that times out is not retried and is answered 504 LdContextNotAvailable. A JSON-LD alternate is a download of its own, and a request naming several remote @contexts waits for each, so keep it well below request_limits.timeout.

Default
"10s"
Must be
1s ≤ timeout < request_limits.timeout
Environment variable
ANDROMEDA__JSONLD__FETCH__TIMEOUT

jsonld.fetch.max_size​

non-zero sizerestart to apply

The largest @context document the broker downloads. A larger one is refused with 504 LdContextNotAvailable.

Default
"2 MiB"
Must be
0 < max_size
Environment variable
ANDROMEDA__JSONLD__FETCH__MAX_SIZE

jsonld.fetch.private_addresses​

stringrestart to apply

Whether a @context URL resolving into private or reserved address space is downloaded, and so every redirect and JSON-LD alternate the download follows. Checked against the address actually resolved, not the host name. jsonld.fetch.allowed_addresses exempts addresses from "refused", and jsonld.fetch.denied_addresses refuses addresses whatever this is set to. A refused download is answered 504 LdContextNotAvailable. Set "refused" when clients you do not trust can name a @context.

Default
"allowed"
Allowed values
"allowed"Any endpoint the broker's network reaches is contacted.
"refused"An endpoint whose resolved address is loopback, private or reserved is refused, so a client-supplied endpoint cannot aim the broker at internal hosts. The refusal is recorded as a failed request.
Environment variable
ANDROMEDA__JSONLD__FETCH__PRIVATE_ADDRESSES

jsonld.fetch.allowed_addresses​

list of stringrestart to apply

IP addresses and subnets ("10.2.0.0/24", "10.3.0.17", "fd00:1234::/48") that a @context download may resolve into even though jsonld.fetch.private_addresses is "refused", such as a server in the broker's own network that hosts the contexts its clients use. Empty by default. An entry in jsonld.fetch.denied_addresses takes precedence.

Default
[]
Environment variable
ANDROMEDA__JSONLD__FETCH__ALLOWED_ADDRESSES

jsonld.fetch.denied_addresses​

list of stringrestart to apply

IP addresses and subnets ("203.0.113.0/24", "198.51.100.9") that a @context download must not resolve into, public ones included and whatever jsonld.fetch.private_addresses is set to. Empty by default. Takes precedence over jsonld.fetch.allowed_addresses.

Default
[]
Environment variable
ANDROMEDA__JSONLD__FETCH__DENIED_ADDRESSES

[jsonld.cache]​

How long resolved contexts are kept in memory.
[jsonld.cache]
max_entries = 1024
default_lifetime = "1h"
hosted_revalidation_interval = "1m"
hit_flush_interval = "5s"

jsonld.cache.max_entries​

positive integerrestart to apply

The most entries each in-process context cache holds.

Default
1024
Must be
0 < max_entries
Environment variable
ANDROMEDA__JSONLD__CACHE__MAX_ENTRIES

jsonld.cache.default_lifetime​

durationrestart to apply

How long a downloaded @context is kept when its response sets no Expires and no Cache-Control max-age or s-maxage, and how long a term-cache entry lives. A response that sets one of those keeps its own lifetime.

Default
"1h"
Must be
1s ≤ default_lifetime
Environment variable
ANDROMEDA__JSONLD__CACHE__DEFAULT_LIFETIME

jsonld.cache.hosted_revalidation_interval​

durationrestart to apply

How long a broker process uses its in-memory copy of a @context the broker stores itself before reading it from the database again, since another process sharing the database may have deleted it. It is also the max-age sent when such a @context is served, in whole seconds.

Default
"1m"
Must be
1s ≤ hosted_revalidation_interval
Environment variable
ANDROMEDA__JSONLD__CACHE__HOSTED_REVALIDATION_INTERVAL

jsonld.cache.hit_flush_interval​

non-zero durationrestart to apply

How often the numberOfHits counters of stored @contexts are written to the database.

Default
"5s"
Must be
0 < hit_flush_interval
Environment variable
ANDROMEDA__JSONLD__CACHE__HIT_FLUSH_INTERVAL