fix(config): lua 5.1 compatibility and multi-tenant validation
- Replace goto statements with if-not pattern for Lua 5.1 compatibility - Validate mail config only for API keys with mail:send permissions - Safe display of API key info for monitoring keys without mail config - Fix health check SMTP detection for new config structure - Multi-tenant system tested and working on port 7811 Fixes multi-tenant config parsing, validation, and health checks. Related to DAW/furt#89
This commit is contained in:
parent
a5db9a633f
commit
8ec401930c
4 changed files with 75 additions and 49 deletions
|
|
@ -67,11 +67,28 @@ print(" Default SMTP: " .. (config.smtp_default.host or "not configured"))
|
|||
local api_key_count = 0
|
||||
for key_name, key_config in pairs(config.api_keys) do
|
||||
api_key_count = api_key_count + 1
|
||||
|
||||
-- Check if this API key has mail permissions
|
||||
local has_mail_permission = false
|
||||
if key_config.permissions then
|
||||
for _, perm in ipairs(key_config.permissions) do
|
||||
if perm == "mail:send" or perm == "*" then
|
||||
has_mail_permission = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local smtp_info = ""
|
||||
if key_config.mail_smtp_host then
|
||||
smtp_info = " (custom SMTP: " .. key_config.mail_smtp_host .. ")"
|
||||
end
|
||||
print(" API Key: " .. key_config.name .. " -> " .. key_config.mail_to .. smtp_info)
|
||||
|
||||
if has_mail_permission then
|
||||
print(" API Key: " .. key_config.name .. " -> " .. key_config.mail_to .. smtp_info)
|
||||
else
|
||||
print(" API Key: " .. key_config.name .. " (no mail)" .. smtp_info)
|
||||
end
|
||||
end
|
||||
print(" Total API Keys: " .. api_key_count)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue