Comparison

util/prosodyctl/shell.lua @ 10867:561138169983

util.prosodyctl.shell: Join socket path with current data directory Don't hardcode socket path as it happens to be in a source checkout. Hold on, it should use the same config option as the module!
author Kim Alvefur <zash@zash.se>
date Mon, 01 Jun 2020 23:26:30 +0200
parent 10859:8de0057b4279
child 10868:fa06cf7059cd
comparison
equal deleted inserted replaced
10866:5265f7fe11dd 10867:561138169983
6 os.exit(1); 6 os.exit(1);
7 end 7 end
8 8
9 local server = require "net.server"; 9 local server = require "net.server";
10 local st = require "util.stanza"; 10 local st = require "util.stanza";
11 local path = require "util.paths";
11 12
12 local have_readline, readline = pcall(require, "readline"); 13 local have_readline, readline = pcall(require, "readline");
13 14
14 local adminstream = require "util.adminstream"; 15 local adminstream = require "util.adminstream";
15 16
110 if stanza.name == "repl-result" then 111 if stanza.name == "repl-result" then
111 repl(client); 112 repl(client);
112 end 113 end
113 end); 114 end);
114 115
115 local conn = connection("data/prosody.sock", client.listeners); 116 local socket_path = path.join(prosody.paths.data, "prosody.sock");
117 local conn = connection(socket_path, client.listeners);
116 local ok, err = conn:connect(); 118 local ok, err = conn:connect();
117 if not ok then 119 if not ok then
118 print("** Unable to connect to server - is it running? Is mod_admin_shell enabled?"); 120 print("** Unable to connect to server - is it running? Is mod_admin_shell enabled?");
119 print("** Connection error: "..err); 121 print("** Connection error: "..err);
120 os.exit(1); 122 os.exit(1);