aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2025-02-22 00:00:41 +0100
committerKim Alvefur <zash@zash.se>2025-02-22 00:00:41 +0100
commit9eedb15c6fc760e45316a02cf372b00bb6547f09 (patch)
treeefd1b6b0e309c513235eb571854eef79cc658bac /util
parent13dc010593fc7968faa3bd713a43893a2dff4f19 (diff)
downloadprosody-9eedb15c6fc760e45316a02cf372b00bb6547f09.tar.gz
prosody-9eedb15c6fc760e45316a02cf372b00bb6547f09.zip
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.
Diffstat (limited to 'util')
-rw-r--r--util/startup.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/util/startup.lua b/util/startup.lua
index 34c2f733..15f07fdf 100644
--- a/util/startup.lua
+++ b/util/startup.lua
@@ -89,6 +89,14 @@ function startup.read_config()
end
end
prosody.config_file = filename
+ local credentials_directory = os.getenv("CREDENTIALS_DIRECTORY");
+ if credentials_directory then
+ config.set_credentials_directory(credentials_directory);
+ elseif prosody.process_type == "prosody" then
+ config.set_credential_fallback_mode("error");
+ else
+ config.set_credential_fallback_mode("warn");
+ end
local ok, level, err = config.load(filename);
if not ok then
print("\n");
@@ -271,7 +279,6 @@ function startup.init_global_state()
config = CFG_CONFIGDIR or ".";
plugins = CFG_PLUGINDIR or "plugins";
data = "data";
- credentials = os.getenv("CREDENTIALS_DIRECTORY");
};
prosody.arg = _G.arg;