Software / code / prosody
Comparison
prosodyctl @ 5292:46fbb5f1ef0a
prosodyctl: Load LFS and util.openssl when actually needed (fixes unhelpful warnings if no LuaSec installed)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 08 Jan 2013 13:33:35 +0100 |
| parent | 5152:fee5f8d4ec74 |
| child | 5293:fe9215155453 |
comparison
equal
deleted
inserted
replaced
| 5291:01f7522049fb | 5292:46fbb5f1ef0a |
|---|---|
| 637 | 637 |
| 638 show_message(error_messages[msg]) | 638 show_message(error_messages[msg]) |
| 639 return 1; | 639 return 1; |
| 640 end | 640 end |
| 641 | 641 |
| 642 local openssl = require "util.openssl"; | 642 local openssl; |
| 643 local lfs = require "lfs"; | 643 local lfs; |
| 644 | 644 |
| 645 local cert_commands = {}; | 645 local cert_commands = {}; |
| 646 | 646 |
| 647 local function ask_overwrite(filename) | 647 local function ask_overwrite(filename) |
| 648 return lfs.attributes(filename) and not show_yesno("Overwrite "..filename .. "?"); | 648 return lfs.attributes(filename) and not show_yesno("Overwrite "..filename .. "?"); |
| 742 end | 742 end |
| 743 end | 743 end |
| 744 | 744 |
| 745 function commands.cert(arg) | 745 function commands.cert(arg) |
| 746 if #arg >= 1 and arg[1] ~= "--help" then | 746 if #arg >= 1 and arg[1] ~= "--help" then |
| 747 openssl = require "util.openssl"; | |
| 748 lfs = require "lfs"; | |
| 747 local subcmd = table.remove(arg, 1); | 749 local subcmd = table.remove(arg, 1); |
| 748 if type(cert_commands[subcmd]) == "function" then | 750 if type(cert_commands[subcmd]) == "function" then |
| 749 if not arg[1] then | 751 if not arg[1] then |
| 750 show_message"You need to supply at least one hostname" | 752 show_message"You need to supply at least one hostname" |
| 751 arg = { "--help" }; | 753 arg = { "--help" }; |