diff options
author | Kim Alvefur <zash@zash.se> | 2021-05-17 16:51:11 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-05-17 16:51:11 +0200 |
commit | c7396c9aac97201b3a37acbdf07a08eede93e7f3 (patch) | |
tree | 34993d8d8f43b428e6c2c99174904a00edaddd96 /tools | |
parent | 7d5c227a04e98687407d3d9d016d9953f42c1da5 (diff) | |
download | prosody-c7396c9aac97201b3a37acbdf07a08eede93e7f3.tar.gz prosody-c7396c9aac97201b3a37acbdf07a08eede93e7f3.zip |
tools/cfgdump: Serialize individual (table) settings in stable order too
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/cfgdump.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/cfgdump.lua b/tools/cfgdump.lua index 1e9366f8..8c331a58 100755 --- a/tools/cfgdump.lua +++ b/tools/cfgdump.lua @@ -5,8 +5,15 @@ local s_format, print = string.format, print; local printf = function(fmt, ...) return print(s_format(fmt, ...)); end local it = require "util.iterators"; -local serialization = require"util.serialization"; -local serialize = serialization.new and serialization.new({ unquoted = true }) or serialization.serialize; +local function sort_anything(a, b) + local typeof_a, typeof_b = type(a), type(b); + if typeof_a ~= typeof_b then return typeof_a < typeof_b end + return a < b -- should work for everything in a config file +end +local serialization = require "util.serialization"; +local serialize = serialization.new and serialization.new({ + unquoted = true, table_iterator = function(t) return it.sorted_pairs(t, sort_anything); end, +}) or serialization.serialize; local configmanager = require"core.configmanager"; local startup = require "util.startup"; |