Lightning.Adaptors.Config (Lightning v2.19.0)

View Source

Runtime configuration for the adaptors subsystem, read from config :lightning, Lightning.Adaptors on every call.

Strategy-specific options live under the strategy module's own key; see strategy_opts/1.

Summary

Functions

How long a read waits for a cache fill, in milliseconds. Defaults to 15 seconds.

The supervisor instance public Lightning.Adaptors functions read through when called with no explicit instance. Defaults to Lightning.Adaptors, the one started in application.ex.

Bound, in milliseconds, on how long Lightning.Adaptors.ensure_loaded/1 and Lightning.Adaptors.fetch_adaptor/2 block waiting for the catalogue's first load. Defaults to 90 seconds.

Filesystem path of the icon cache. A {:tmp, suffix} value is joined to System.tmp_dir!/0 at call time; a binary is returned as is. Defaults to {:tmp, "lightning/adaptor_icons"}.

Scheduler tick interval in milliseconds. Defaults to one hour.

The catalogue source a strategy writes under.

The active strategy module. Defaults to Lightning.Adaptors.NPM.

Options configured under the strategy module's own application key, or [] when unset.

Whether a scheduler booting on an empty catalogue that no timer will fill should warn an operator. Defaults to true. Read once by Lightning.Adaptors.Supervisor at boot and passed to the scheduler.

Functions

cache_timeout_ms()

@spec cache_timeout_ms() :: non_neg_integer()

How long a read waits for a cache fill, in milliseconds. Defaults to 15 seconds.

default_instance()

@spec default_instance() :: atom()

The supervisor instance public Lightning.Adaptors functions read through when called with no explicit instance. Defaults to Lightning.Adaptors, the one started in application.ex.

Tests stub this to isolate reads to a private instance; see Lightning.AdaptorTestHelpers.isolated_adaptors/1.

first_load_timeout()

@spec first_load_timeout() :: non_neg_integer()

Bound, in milliseconds, on how long Lightning.Adaptors.ensure_loaded/1 and Lightning.Adaptors.fetch_adaptor/2 block waiting for the catalogue's first load. Defaults to 90 seconds.

icon_path()

@spec icon_path() :: Path.t()

Filesystem path of the icon cache. A {:tmp, suffix} value is joined to System.tmp_dir!/0 at call time; a binary is returned as is. Defaults to {:tmp, "lightning/adaptor_icons"}.

refresh_interval()

@spec refresh_interval() :: non_neg_integer()

Scheduler tick interval in milliseconds. Defaults to one hour.

source_for(strategy)

@spec source_for(module()) :: :local | :npm

The catalogue source a strategy writes under.

Lightning.Adaptors.Local and Lightning.Adaptors.NPM are mapped here; any other strategy must declare a :source of :npm or :local under its own application key, or this raises rather than guessing at :npm.

strategy()

@spec strategy() :: module()

The active strategy module. Defaults to Lightning.Adaptors.NPM.

strategy_opts(strategy_mod)

@spec strategy_opts(module()) :: keyword()

Options configured under the strategy module's own application key, or [] when unset.

warn_when_empty?()

@spec warn_when_empty?() :: boolean()

Whether a scheduler booting on an empty catalogue that no timer will fill should warn an operator. Defaults to true. Read once by Lightning.Adaptors.Supervisor at boot and passed to the scheduler.