projects
/
pazpar2-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow result reuse again
[pazpar2-moved-to-github.git]
/
src
/
pazpar2_config.c
diff --git
a/src/pazpar2_config.c
b/src/pazpar2_config.c
index
82ce585
..
838d322
100644
(file)
--- a/
src/pazpar2_config.c
+++ b/
src/pazpar2_config.c
@@
-54,6
+54,7
@@
struct conf_config
int no_threads;
WRBUF confdir;
int no_threads;
WRBUF confdir;
+ char *path;
iochan_man_t iochan_man;
};
iochan_man_t iochan_man;
};
@@
-255,13
+256,20
@@
int conf_service_sortkey_field_id(struct conf_service *service,
static void conf_dir_path(struct conf_config *config, WRBUF w, const char *src)
{
static void conf_dir_path(struct conf_config *config, WRBUF w, const char *src)
{
- if (config->confdir && wrbuf_len(config->confdir) > 0 &&
- !yaz_is_abspath(src))
+ char full_path[1024];
+ if (yaz_filepath_resolve(src, config->path,
+ wrbuf_len(config->confdir) > 0 ?
+ wrbuf_cstr(config->confdir) : ".",
+ full_path))
{
{
- wrbuf_printf(w, "%s/%s", wrbuf_cstr(config->confdir), src);
+ wrbuf_puts(w, full_path);
}
else
}
else
+ {
+ yaz_log(YLOG_WARN, "File not found: fname=%s path=%s base=%s", src,
+ config->path, wrbuf_cstr(config->confdir));
wrbuf_puts(w, src);
wrbuf_puts(w, src);
+ }
}
void service_destroy(struct conf_service *service)
}
void service_destroy(struct conf_service *service)
@@
-1242,6
+1250,15
@@
static int parse_config(struct conf_config *config, xmlNode *root)
xmlFree(number);
}
}
xmlFree(number);
}
}
+ else if (!strcmp((const char *) n->name, "file"))
+ {
+ xmlChar *path = xmlGetProp(n, (xmlChar *) "path");
+ if (path)
+ {
+ config->path = nmem_strdup(config->nmem, (const char *) path);
+ xmlFree(path);
+ }
+ }
else if (!strcmp((const char *) n->name, "targetprofiles"))
{
yaz_log(YLOG_FATAL, "targetprofiles unsupported here. Must be part of service");
else if (!strcmp((const char *) n->name, "targetprofiles"))
{
yaz_log(YLOG_FATAL, "targetprofiles unsupported here. Must be part of service");
@@
-1257,7
+1274,7
@@
static int parse_config(struct conf_config *config, xmlNode *root)
return 0;
}
return 0;
}
-struct conf_config *config_create(const char *fname, int verbose)
+struct conf_config *config_create(const char *fname)
{
xmlDoc *doc = xmlReadFile(fname,
NULL,
{
xmlDoc *doc = xmlReadFile(fname,
NULL,
@@
-1288,6
+1305,7
@@
struct conf_config *config_create(const char *fname, int verbose)
config->nmem = nmem;
config->servers = 0;
config->nmem = nmem;
config->servers = 0;
+ config->path = nmem_strdup(nmem, ".");
config->no_threads = 0;
config->iochan_man = 0;
config->no_threads = 0;
config->iochan_man = 0;
@@
-1309,16
+1327,13
@@
struct conf_config *config_create(const char *fname, int verbose)
r = yaz_xml_include_simple(n, wrbuf_cstr(config->confdir));
if (r == 0) /* OK */
{
r = yaz_xml_include_simple(n, wrbuf_cstr(config->confdir));
if (r == 0) /* OK */
{
- if (verbose)
- {
- yaz_log(YLOG_LOG, "Configuration %s after include processing",
- fname);
+ yaz_log(YLOG_LOG, "Configuration %s after include processing",
+ fname);
#if LIBXML_VERSION >= 20600
#if LIBXML_VERSION >= 20600
- xmlDocFormatDump(yaz_log_file(), doc, 0);
+ xmlDocFormatDump(yaz_log_file(), doc, 0);
#else
#else
- xmlDocDump(yaz_log_file(), doc);
+ xmlDocDump(yaz_log_file(), doc);
#endif
#endif
- }
r = parse_config(config, n);
}
xmlFreeDoc(doc);
r = parse_config(config, n);
}
xmlFreeDoc(doc);