Skip to content

Commit d19ef80

Browse files
authored
body factory does not respect runroot (apache#8388)
1 parent 870b857 commit d19ef80

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

lib/records/RecConfigParse.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ RecConfigOverrideFromRunroot(const char *name)
8989
if (!get_runroot().empty()) {
9090
if (!strcmp(name, "proxy.config.bin_path") || !strcmp(name, "proxy.config.local_state_dir") ||
9191
!strcmp(name, "proxy.config.log.logfile_dir") || !strcmp(name, "proxy.config.plugin.plugin_dir") ||
92-
!strcmp(name, "proxy.config.hostdb.storage_path")) {
92+
!strcmp(name, "proxy.config.hostdb.storage_path") || !strcmp(name, "proxy.config.body_factory.template_sets_dir")) {
9393
return true;
9494
}
9595
}

proxy/http/HttpBodyFactory.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,13 @@ HttpBodyFactory::reconfigure()
282282
rec_err = RecGetRecordString_Xmalloc("proxy.config.body_factory.template_sets_dir", &s);
283283
all_found = all_found && (rec_err == REC_ERR_OKAY);
284284
if (rec_err == REC_ERR_OKAY) {
285-
directory_of_template_sets = Layout::get()->relative(s);
285+
// check if we should tweak with run_root value
286+
if (s && strlen(s) > 0) {
287+
// the value is set via config file or ENV var
288+
directory_of_template_sets = Layout::get()->relative(s);
289+
} else {
290+
directory_of_template_sets = Layout::relative_to(RecConfigReadConfigDir(), "body_factory");
291+
}
286292
if (access(directory_of_template_sets, R_OK) < 0) {
287293
Warning("Unable to access() directory '%s': %d, %s", (const char *)directory_of_template_sets, errno, strerror(errno));
288294
Warning(" Please set 'proxy.config.body_factory.template_sets_dir' ");

0 commit comments

Comments
 (0)