Remove proxy override.
[pazpar2-moved-to-github.git] / src / pazpar2_config.c
index 24f4c86..c937927 100644 (file)
@@ -46,7 +46,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #endif
 #include <sys/types.h>
 #include <sys/stat.h>
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include "pazpar2_config.h"
 #include "settings.h"
 #include "eventl.h"
@@ -751,7 +753,7 @@ static int config_include_one(struct conf_config *config, xmlNode **sib,
     }
     else
     {
-        if (S_ISREG(st.st_mode))
+        if ((st.st_mode & S_IFMT) == S_IFREG)
         {
             xmlDoc *doc = xmlParseFile(path);
             yaz_log(YLOG_LOG, "processing include path=%s", path);
@@ -847,7 +849,7 @@ static int process_config_includes(struct conf_config *config, xmlNode *n)
     return 0;
 }
 
-struct conf_config *config_create(const char *fname)
+struct conf_config *config_create(const char *fname, int verbose)
 {
     xmlDoc *doc = xmlParseFile(fname);
     xmlNode *n;
@@ -885,7 +887,12 @@ struct conf_config *config_create(const char *fname)
     r = process_config_includes(config, n);
     if (r == 0) /* OK */
     {
-        xmlDocFormatDump(stdout, doc, 0);
+        if (verbose)
+        {
+            yaz_log(YLOG_LOG, "Configuration %s after include processing",
+                    fname);
+            xmlDocFormatDump(yaz_log_file(), doc, 0);
+        }
         r = parse_config(config, n);
     }
     xmlFreeDoc(doc);
@@ -928,16 +935,13 @@ void config_destroy(struct conf_config *config)
     }
 }
 
-void config_read_settings(struct conf_config *config,
-                          const char *path_override)
+void config_read_settings(struct conf_config *config)
 {
     struct conf_service *s = config->servers->service;
     for (;s ; s = s->next)
     {
         init_settings(s);
-        if (path_override)
-            settings_read(s, path_override);
-        else if (s->settings)
+        if (s->settings)
             settings_read(s, s->settings);
         else if (config->servers->server_settings)
             settings_read(s, config->servers->server_settings);
@@ -954,8 +958,7 @@ void config_stop_listeners(struct conf_config *conf)
 }
 
 int config_start_listeners(struct conf_config *conf,
-                           const char *listener_override,
-                           const char *proxy_override)
+                           const char *listener_override)
 {
     struct conf_server *ser;
     for (ser = conf->servers; ser; ser = ser->next)
@@ -984,9 +987,7 @@ int config_start_listeners(struct conf_config *conf,
             return -1;
 
         w = wrbuf_alloc();
-        if (proxy_override)
-            wrbuf_puts(w, proxy_override);
-        else if (ser->proxy_host || ser->proxy_port)
+        if (ser->proxy_host || ser->proxy_port)
         {
             if (ser->proxy_host)
                 wrbuf_puts(w, ser->proxy_host);