mirror of
https://github.com/KumoCorp/kumomta.git
synced 2026-08-19 16:01:08 +00:00
14 lines
458 B
Lua
14 lines
458 B
Lua
local mod = {}
|
|
local kumo = require 'kumo'
|
|
|
|
-- Resolve our hostname, then derive the docker network from that.
|
|
-- This assumes that the network is a /24 and that HOSTNAME is
|
|
-- injected by docker and resolves to the container IP on that network
|
|
function mod.resolve_docker_network()
|
|
local MY_IPS = kumo.dns.lookup_addr(os.getenv 'HOSTNAME')
|
|
local DOCKER_NETWORK = string.match(MY_IPS[1], '^(.*)%.%d+$') .. '.0/24'
|
|
return DOCKER_NETWORK
|
|
end
|
|
|
|
return mod
|