mirror of
https://github.com/KumoCorp/kumomta.git
synced 2026-11-23 00:01:03 +00:00
Nobody runs it and it is not as good as RocksDB. I want to remove it in the future so that users don't unwittingly deploy a poor configuration. We now log errors on startup to help surface configuration that will need attention, but we don't block startup.
76 lines
2.0 KiB
Lua
76 lines
2.0 KiB
Lua
local kumo = require 'kumo'
|
|
package.path = '../../assets/?.lua;' .. package.path
|
|
local shaping = require 'policy-extras.shaping'
|
|
local utils = require 'policy-extras.policy_utils'
|
|
|
|
local TEST_DIR = os.getenv 'KUMOD_TEST_DIR'
|
|
local SINK_PORT = tonumber(os.getenv 'KUMOD_SMTP_SINK_PORT')
|
|
local TSA_URL =
|
|
string.format('http://127.0.0.1:%s', os.getenv 'KUMOD_TSA_PORT')
|
|
|
|
local shaper = shaping:setup_with_automation {
|
|
publish = { TSA_URL },
|
|
subscribe = { TSA_URL },
|
|
cache_ttl = '1 second',
|
|
no_default_files = true,
|
|
extra_files = { 'shaping.toml' },
|
|
pre_filter = true,
|
|
back_pressure = 128000,
|
|
-- Augment the default uninteresting set with Delivery, so that
|
|
-- successful delivery records do not reach TSA for matching.
|
|
additional_skip_log_record_types = { 'Delivery' },
|
|
}
|
|
|
|
kumo.on('init', function()
|
|
kumo.configure_accounting_db_path(TEST_DIR .. '/accounting.db')
|
|
|
|
kumo.start_esmtp_listener {
|
|
listen = '127.0.0.1:0',
|
|
relay_hosts = { '0.0.0.0/0' },
|
|
}
|
|
|
|
kumo.start_http_listener {
|
|
listen = '127.0.0.1:0',
|
|
}
|
|
|
|
kumo.configure_local_logs {
|
|
log_dir = TEST_DIR .. '/logs',
|
|
max_segment_duration = '1s',
|
|
max_file_size = 1,
|
|
}
|
|
|
|
kumo.define_spool {
|
|
kind = 'RocksDB',
|
|
name = 'data',
|
|
path = TEST_DIR .. '/data-spool',
|
|
}
|
|
|
|
kumo.define_spool {
|
|
kind = 'RocksDB',
|
|
name = 'meta',
|
|
path = TEST_DIR .. '/meta-spool',
|
|
}
|
|
shaper.setup_publish()
|
|
end)
|
|
|
|
kumo.on('get_listener_domain', function(domain, listener, conn_meta)
|
|
return kumo.make_listener_domain {
|
|
relay_to = true,
|
|
log_oob = true,
|
|
log_arf = true,
|
|
}
|
|
end)
|
|
|
|
kumo.on('smtp_server_message_received', function(msg)
|
|
msg:set_meta('routing_domain', 'localhost')
|
|
end)
|
|
|
|
kumo.on('get_egress_path_config', function(domain, egress_source, site_name)
|
|
local skip_make = true
|
|
local params =
|
|
shaper.get_egress_path_config(domain, egress_source, site_name, skip_make)
|
|
params.smtp_port = SINK_PORT
|
|
params.prohibited_hosts = {}
|
|
return kumo.make_egress_path(params)
|
|
end)
|