Software /
code /
prosody
Comparison
plugins/mod_admin_telnet.lua @ 9755:fd4d516556aa
mod_admin_telnet: Serialize config values (table: 0x123abc isn't useful)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 04 Jan 2019 13:41:39 +0100 |
parent | 9754:cbbc6fefd07d |
child | 9756:38f7bde4cfe0 |
comparison
equal
deleted
inserted
replaced
9754:cbbc6fefd07d | 9755:fd4d516556aa |
---|---|
30 local cert_verify_identity = require "util.x509".verify_identity; | 30 local cert_verify_identity = require "util.x509".verify_identity; |
31 local envload = require "util.envload".envload; | 31 local envload = require "util.envload".envload; |
32 local envloadfile = require "util.envload".envloadfile; | 32 local envloadfile = require "util.envload".envloadfile; |
33 local has_pposix, pposix = pcall(require, "util.pposix"); | 33 local has_pposix, pposix = pcall(require, "util.pposix"); |
34 local async = require "util.async"; | 34 local async = require "util.async"; |
35 local serialize = require "util.serialization".new({ fatal = false, unquoted = true}); | |
35 | 36 |
36 local commands = module:shared("commands") | 37 local commands = module:shared("commands") |
37 local def_env = module:shared("env"); | 38 local def_env = module:shared("env"); |
38 local default_env_mt = { __index = def_env }; | 39 local default_env_mt = { __index = def_env }; |
39 | 40 |
498 function def_env.config:get(host, key) | 499 function def_env.config:get(host, key) |
499 if key == nil then | 500 if key == nil then |
500 host, key = "*", host; | 501 host, key = "*", host; |
501 end | 502 end |
502 local config_get = require "core.configmanager".get | 503 local config_get = require "core.configmanager".get |
503 return true, tostring(config_get(host, key)); | 504 return true, serialize(config_get(host, key)); |
504 end | 505 end |
505 | 506 |
506 function def_env.config:reload() | 507 function def_env.config:reload() |
507 local ok, err = prosody.reload_config(); | 508 local ok, err = prosody.reload_config(); |
508 return ok, (ok and "Config reloaded (you may need to reload modules to take effect)") or tostring(err); | 509 return ok, (ok and "Config reloaded (you may need to reload modules to take effect)") or tostring(err); |