Comparison

util/startup.lua @ 8637:c8368c7c81a1

util.startup: Trim trailing whitespace [luacheck]
author Kim Alvefur <zash@zash.se>
date Wed, 21 Mar 2018 10:26:29 +0100
parent 8636:8691083420e4
child 8638:f8f45bbbd8ba
comparison
equal deleted inserted replaced
8636:8691083420e4 8637:c8368c7c81a1
341 function startup.log_greeting() 341 function startup.log_greeting()
342 log("info", "Hello and welcome to Prosody version %s", prosody.version); 342 log("info", "Hello and welcome to Prosody version %s", prosody.version);
343 end 343 end
344 344
345 function startup.notify_started() 345 function startup.notify_started()
346 prosody.events.fire_event("server-started"); 346 prosody.events.fire_event("server-started");
347 end 347 end
348 348
349 -- Override logging config (used by prosodyctl) 349 -- Override logging config (used by prosodyctl)
350 function startup.force_console_logging() 350 function startup.force_console_logging()
351 local original_logging_config = config.get("*", "log"); 351 local original_logging_config = config.get("*", "log");
400 print("Error was "..err); 400 print("Error was "..err);
401 os.exit(1); 401 os.exit(1);
402 end 402 end
403 end 403 end
404 end 404 end
405 405
406 -- Set our umask to protect data files 406 -- Set our umask to protect data files
407 pposix.umask(config.get("*", "umask") or "027"); 407 pposix.umask(config.get("*", "umask") or "027");
408 pposix.setenv("HOME", data_path); 408 pposix.setenv("HOME", data_path);
409 pposix.setenv("PROSODY_CONFIG", ENV_CONFIG); 409 pposix.setenv("PROSODY_CONFIG", ENV_CONFIG);
410 else 410 else
422 return false, err; 422 return false, err;
423 end 423 end
424 f:close(); 424 f:close();
425 return true; 425 return true;
426 end 426 end
427 427
428 local unwriteable_files = {}; 428 local unwriteable_files = {};
429 if type(original_logging_config) == "string" and original_logging_config:sub(1,1) ~= "*" then 429 if type(original_logging_config) == "string" and original_logging_config:sub(1,1) ~= "*" then
430 local ok, err = test_writeable(original_logging_config); 430 local ok, err = test_writeable(original_logging_config);
431 if not ok then 431 if not ok then
432 table.insert(unwriteable_files, err); 432 table.insert(unwriteable_files, err);
439 table.insert(unwriteable_files, err); 439 table.insert(unwriteable_files, err);
440 end 440 end
441 end 441 end
442 end 442 end
443 end 443 end
444 444
445 if #unwriteable_files > 0 then 445 if #unwriteable_files > 0 then
446 print("One of more of the Prosody log files are not"); 446 print("One of more of the Prosody log files are not");
447 print("writeable, please correct the errors and try"); 447 print("writeable, please correct the errors and try");
448 print("starting prosodyctl again."); 448 print("starting prosodyctl again.");
449 print(""); 449 print("");
467 modules = {}, 467 modules = {},
468 sessions = {}, 468 sessions = {},
469 users = require "core.usermanager".new_null_provider(hostname) 469 users = require "core.usermanager".new_null_provider(hostname)
470 }; 470 };
471 end 471 end
472 472
473 for hostname, config in pairs(config.getconfig()) do 473 for hostname, config in pairs(config.getconfig()) do
474 hosts[hostname] = make_host(hostname); 474 hosts[hostname] = make_host(hostname);
475 end 475 end
476 end 476 end
477 477