class Config
Loads, validates, and provides dot-notation access to a mautrix bridgev2-compatible YAML configuration file.
The full schema mirrors the Go structs defined in mautrix/go v0.27.0 bridgev2/bridgeconfig — split across multiple JSON Schema files under config/schema/ and composed at runtime via $ref.
Validated config data is exposed through Vivify-enhanced hashes, giving natural dot-notation access to every nested field:
config = Config.load("bridge.yml") config.homeserver.address # => "http://synapse:8008" config.homeserver.domain # => "localhost" config.appservice.as_token # => "secret..." config.appservice.bot.username # => "bot" config.bot_mxid # => "@bot:localhost"
Nested
Definitions
def self.load(path)
Load and validate a YAML config file from disk.
Implementation
def self.load(path)
raise Async::Matrix::NotFoundError.new(
"M_NOT_FOUND", "Config not found: #{path}"
) unless File.exist?(path)
data = YAML.safe_load_file(path, permitted_classes: [Symbol])
new(data)
end
def bot_mxid
Convenience: derive the bot's full Matrix ID from appservice.bot.username + homeserver.domain.
Implementation
def bot_mxid
"@#{appservice.bot.username}:#{homeserver.domain}"
end