Software /
code /
prosody
Comparison
prosodyctl @ 12266:24b0c4c4e28a
prosodyctl: Allow install plugin via explicit path or URL
This way you don't need to set the server URL in the config to use this,
you could just ^C^V an install line from a web page that says
prosodyctl install https://modules.example.com/mod_example.src.rock
Drop the help message in this case since it'll be all messed up by being
given an URL or rock filename.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 04 Feb 2022 19:03:02 +0100 |
parent | 12265:47d5233a1fc7 |
child | 12267:a52a0680fcd8 |
comparison
equal
deleted
inserted
replaced
12265:47d5233a1fc7 | 12266:24b0c4c4e28a |
---|---|
82 show_usage([[install]], [[Installs a prosody/luarocks plugin]]); | 82 show_usage([[install]], [[Installs a prosody/luarocks plugin]]); |
83 return opts.help and 0 or 1; | 83 return opts.help and 0 or 1; |
84 end | 84 end |
85 -- TODO finalize config option name | 85 -- TODO finalize config option name |
86 local server = configmanager.get("*", "plugin_server"); | 86 local server = configmanager.get("*", "plugin_server"); |
87 if not server then | 87 if not (arg[1]:match("^https://") or lfs.attributes(arg[1]) or server) then |
88 show_warning("There is no 'plugin_server' option in the configuration file"); | 88 show_warning("There is no 'plugin_server' option in the configuration file"); |
89 -- see https://prosody.im/doc/TODO documentation | 89 -- see https://prosody.im/doc/TODO documentation |
90 -- #1602 | 90 -- #1602 |
91 return 1; | 91 return 1; |
92 end | 92 end |
93 show_message("Installing %s in %s", arg[1], prosody.paths.installer); | 93 show_message("Installing %s in %s", arg[1], prosody.paths.installer); |
94 local ret = call_luarocks("install", arg[1], server); | 94 local ret = call_luarocks("install", arg[1], server); |
95 if ret == 0 then | 95 if ret == 0 and arg[1]:match("^mod_") then |
96 prosodyctl.show_module_configuration_help(arg[1]); | 96 prosodyctl.show_module_configuration_help(arg[1]); |
97 end | 97 end |
98 return ret; | 98 return ret; |
99 end | 99 end |
100 | 100 |