Comparison

prosodyctl @ 6160:cf0f7caa885e

prosodyctl: Check for deprecated config options
author Kim Alvefur <zash@zash.se>
date Fri, 02 May 2014 08:21:56 +0200
parent 6159:4ee14b7ef2cc
child 6161:afcba9737ac3
comparison
equal deleted inserted replaced
6159:4ee14b7ef2cc 6160:cf0f7caa885e
814 print"" 814 print""
815 end 815 end
816 end 816 end
817 if not what or what == "config" then 817 if not what or what == "config" then
818 print("Checking config..."); 818 print("Checking config...");
819 local deprecated = set.new({
820 "bosh_ports", "disallow_s2s", "no_daemonize", "anonymous_login",
821 });
819 local known_global_options = set.new({ 822 local known_global_options = set.new({
820 "pidfile", "log", "plugin_paths", "prosody_user", "prosody_group", "daemonize", 823 "pidfile", "log", "plugin_paths", "prosody_user", "prosody_group", "daemonize",
821 "umask", "prosodyctl_timeout", "use_ipv6", "use_libevent", "network_settings" 824 "umask", "prosodyctl_timeout", "use_ipv6", "use_libevent", "network_settings"
822 }); 825 });
823 local config = config.getconfig(); 826 local config = config.getconfig();
828 print(" No global options defined. Perhaps you have put a host definition at the top") 831 print(" No global options defined. Perhaps you have put a host definition at the top")
829 print(" of the config file? They should be at the bottom, see http://prosody.im/doc/configure#overview"); 832 print(" of the config file? They should be at the bottom, see http://prosody.im/doc/configure#overview");
830 end 833 end
831 -- Check for global options under hosts 834 -- Check for global options under hosts
832 local global_options = set.new(it.to_array(it.keys(config["*"]))); 835 local global_options = set.new(it.to_array(it.keys(config["*"])));
836 local deprecated_global_options = set.intersection(global_options, deprecated);
837 if not deprecated_global_options:empty() then
838 print("");
839 print(" You have some deprecated options in the global section:");
840 print(" "..tostring(deprecated_global_options))
841 ok = false;
842 end
833 for host, options in enabled_hosts() do 843 for host, options in enabled_hosts() do
834 local host_options = set.new(it.to_array(it.keys(options))); 844 local host_options = set.new(it.to_array(it.keys(options)));
835 local misplaced_options = set.intersection(host_options, known_global_options); 845 local misplaced_options = set.intersection(host_options, known_global_options);
836 for name in pairs(options) do 846 for name in pairs(options) do
837 if name:match("^interfaces?") 847 if name:match("^interfaces?")