Comparison

util/startup.lua @ 13743:0c7e11c11968 13.0

core.configmanager: Remove dependency on 'prosody' global for Credential Minimizing dependencies on global state is nice, as it makes using configmanager outside of Prosody easier.
author Kim Alvefur <zash@zash.se>
date Sat, 22 Feb 2025 00:00:41 +0100
parent 13659:5abdcad8c2e0
comparison
equal deleted inserted replaced
13741:e9edf9b50f32 13743:0c7e11c11968
87 CFG_CONFIGDIR = prosody.paths.config; -- luacheck: ignore 111 87 CFG_CONFIGDIR = prosody.paths.config; -- luacheck: ignore 111
88 break; 88 break;
89 end 89 end
90 end 90 end
91 prosody.config_file = filename 91 prosody.config_file = filename
92 local credentials_directory = os.getenv("CREDENTIALS_DIRECTORY");
93 if credentials_directory then
94 config.set_credentials_directory(credentials_directory);
95 elseif prosody.process_type == "prosody" then
96 config.set_credential_fallback_mode("error");
97 else
98 config.set_credential_fallback_mode("warn");
99 end
92 local ok, level, err = config.load(filename); 100 local ok, level, err = config.load(filename);
93 if not ok then 101 if not ok then
94 print("\n"); 102 print("\n");
95 print("**************************"); 103 print("**************************");
96 if level == "parser" then 104 if level == "parser" then
269 prosody.paths = { 277 prosody.paths = {
270 source = CFG_SOURCEDIR; 278 source = CFG_SOURCEDIR;
271 config = CFG_CONFIGDIR or "."; 279 config = CFG_CONFIGDIR or ".";
272 plugins = CFG_PLUGINDIR or "plugins"; 280 plugins = CFG_PLUGINDIR or "plugins";
273 data = "data"; 281 data = "data";
274 credentials = os.getenv("CREDENTIALS_DIRECTORY");
275 }; 282 };
276 283
277 prosody.arg = _G.arg; 284 prosody.arg = _G.arg;
278 285
279 _G.log = logger.init("general"); 286 _G.log = logger.init("general");