comparison core/configmanager.lua @ 13628:4fdd406564ea

core.configmanager: Rename Secret to Credential To match the variable name and what systemd calls them.
author Kim Alvefur <zash@zash.se>
date Sat, 18 Jan 2025 12:31:48 +0100
parents 2db7b3b65363
children 8228f5094f7a
comparison
equal deleted inserted replaced
13627:2db7b3b65363 13628:4fdd406564ea
197 Component = true, component = true, 197 Component = true, component = true,
198 FileContents = true, 198 FileContents = true,
199 FileLine = true, 199 FileLine = true,
200 FileLines = true, 200 FileLines = true,
201 Secret = true, 201 Secret = true,
202 Credential = true,
202 Include = true, include = true, RunScript = true }, { 203 Include = true, include = true, RunScript = true }, {
203 __index = function (_, k) 204 __index = function (_, k)
204 if k:match("^ENV_") then 205 if k:match("^ENV_") then
205 return os.getenv(k:sub(5)); 206 return os.getenv(k:sub(5));
206 end 207 end
359 env.FileContents = filereader(config_path, "*a"); 360 env.FileContents = filereader(config_path, "*a");
360 env.FileLine = filereader(config_path, "*l"); 361 env.FileLine = filereader(config_path, "*l");
361 env.FileLines = linereader(config_path); 362 env.FileLines = linereader(config_path);
362 363
363 if _G.prosody.paths.secrets then 364 if _G.prosody.paths.secrets then
364 env.Secret = filereader(_G.prosody.paths.secrets, "*a"); 365 env.Credential = filereader(_G.prosody.paths.secrets, "*a");
365 elseif _G.prosody.process_type == "prosody" then 366 elseif _G.prosody.process_type == "prosody" then
366 env.Secret = function() error("Secret() requires the $CREDENTIALS_DIRECTORY environment variable to be set", 2) end 367 env.Credential = function() error("Credential() requires the $CREDENTIALS_DIRECTORY environment variable to be set", 2) end
367 else 368 else
368 env.Secret = function() 369 env.Credential = function()
369 t_insert(warnings, ("%s:%d: Secret() requires the $CREDENTIALS_DIRECTORY environment variable to be set") 370 t_insert(warnings, ("%s:%d: Credential() requires the $CREDENTIALS_DIRECTORY environment variable to be set")
370 :format(config_file, get_line_number(config_file))); 371 :format(config_file, get_line_number(config_file)));
371 return nil; 372 return nil;
372 end 373 end
373 374
374 end 375 end
376 env.Secret = env.Credential; -- COMPAT remove after all the early adopters s/Secret/Credential/
375 377
376 local chunk, err = envload(data, "@"..config_file, env); 378 local chunk, err = envload(data, "@"..config_file, env);
377 379
378 if not chunk then 380 if not chunk then
379 return nil, err; 381 return nil, err;