fix env variable load and subst order
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 1m24s
Build-Test-Publish / build (linux/arm64) (push) Successful in 4m16s

This commit is contained in:
2025-10-03 18:56:04 +13:00
parent e001413844
commit af75b0b4ac
13 changed files with 124 additions and 64 deletions

View File

@@ -665,23 +665,23 @@
// ------------------------------------------------------------
// check TEMPLATE= line.
std::map<std::string, std::string> all_env_vars;
ordered_env_vars all_env_vars;
std::vector<std::string> env_files = {
"config/" + filenames::service_env,
"config/" + filenames::template_info_env
};
for (const auto& file : env_files) {
{ // load service.env from the service on this machine.
std::map<std::string, std::string> env_vars;
ordered_env_vars env_vars;
envmanager env_manager(template_path + "/" + file);
env_manager.load();
env_manager.get_all_variables(env_vars);
all_env_vars.merge(env_vars);
merge_vars(all_env_vars, env_vars);
}
}
// determine template name.
auto it = all_env_vars.find("TEMPLATE");
auto it = find_var(all_env_vars, "TEMPLATE");
if (it == all_env_vars.end()) {
error << "TEMPLATE variable not found in " << template_path << std::endl;
return false;