annotation

LavinMQ::Config::IniOpt

Marks a config property as settable from a section in the INI config file.

Named arguments:

  • section: the INI section the key belongs to, one of INI_SECTIONS (e.g. "main", "amqp", "mqtt", "mgmt", "clustering", "oauth", "experimental"). Used to select which properties belong to a section.
  • ini_name: the key name within the section, given as a bare identifier (e.g. ini_name: port). Defaults to the property name.
  • transform: a Proc(String, T) that converts the raw value to the property's type. When omitted, the property's own type is used and the value is converted by the matching Config#parse_value overload.
  • deprecated: a complete warning message, printed verbatim, when the key is used. To forward the old value to a replacement, define a setter (and no getter) on the deprecated property; an option with no replacement defines no setter and its value is dropped after the warning.

Parsed by Config#parse_section.

@[IniOpt(ini_name: port, section: "amqp")]
property amqp_port = 5672

A deprecated key whose value is forwarded to a replacement: declare the instance variable (not a property) and define only the setter, which assigns to the new property.

@[IniOpt(ini_name: tls_cert, section: "amqp",
  deprecated: "Ini config tls_cert in [amqp] is deprecated, use tls_cert in [main] instead")]
@amqp_tls_cert = ""

def amqp_tls_cert=(value)
  @tls_cert_path = value # forward to the replacement
end