summaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-10 17:10:20 +0200
committerChristian Grothoff <christian@grothoff.org>2016-04-10 17:10:20 +0200
commit30d66bcebc27a1cdcbad39ddbeeaf047da6cc1dd (patch)
treeb78ddf34d0360b2cf87037009d32dac0d3eaeb91 /src/exchangedb
parent5fb65f59b2de184f4fcb1417923711bd64fe781a (diff)
downloadexchange-30d66bcebc27a1cdcbad39ddbeeaf047da6cc1dd.tar.gz
exchange-30d66bcebc27a1cdcbad39ddbeeaf047da6cc1dd.tar.bz2
exchange-30d66bcebc27a1cdcbad39ddbeeaf047da6cc1dd.zip
fixing #4386: use more sane configuration and data file structure
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/Makefile.am11
-rw-r--r--src/exchangedb/exchangedb-postgres.conf2
-rw-r--r--src/exchangedb/exchangedb.conf7
-rw-r--r--src/exchangedb/exchangedb_keyio.c21
4 files changed, 31 insertions, 10 deletions
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
index fff112994..0c6a73138 100644
--- a/src/exchangedb/Makefile.am
+++ b/src/exchangedb/Makefile.am
@@ -6,6 +6,17 @@ if USE_COVERAGE
XLIB = -lgcov
endif
+pkgcfgdir = $(prefix)/share/taler/config.d/
+
+pkgcfg_DATA = \
+ exchangedb.conf \
+ exchangedb-postgres.conf
+
+EXTRA_DIST = \
+ exchangedb.conf \
+ exchangedb-postgres.conf
+
+
plugindir = $(libdir)/taler
if HAVE_POSTGRESQL
diff --git a/src/exchangedb/exchangedb-postgres.conf b/src/exchangedb/exchangedb-postgres.conf
new file mode 100644
index 000000000..3de7474ff
--- /dev/null
+++ b/src/exchangedb/exchangedb-postgres.conf
@@ -0,0 +1,2 @@
+[exchangedb-postgres]
+DB_CONN_STR = "postgres:///taler"
diff --git a/src/exchangedb/exchangedb.conf b/src/exchangedb/exchangedb.conf
new file mode 100644
index 000000000..19277ed23
--- /dev/null
+++ b/src/exchangedb/exchangedb.conf
@@ -0,0 +1,7 @@
+# This file is in the public domain.
+#
+# Database-backend independent specification for the exchangedb module.
+#
+[exchangedb]
+# Where do we expect to find information about auditors?
+AUDITOR_BASE_DIR = ${TALER_DATA_HOME}/auditors/
diff --git a/src/exchangedb/exchangedb_keyio.c b/src/exchangedb/exchangedb_keyio.c
index 4d4f78ed5..9f170f645 100644
--- a/src/exchangedb/exchangedb_keyio.c
+++ b/src/exchangedb/exchangedb_keyio.c
@@ -502,9 +502,7 @@ auditor_iter (void *cls,
/**
* Call @a it with information for each auditor found in the @a exchange_base_dir.
*
- * @param exchange_base_dir base directory for the exchange,
- * the signing keys must be in the #TALER_EXCHANGEDB_DIR_DENOMINATION_KEYS
- * subdirectory
+ * @param cfg configuration to use
* @param it function to call with auditor information
* @param it_cls closure for @a it
* @return -1 on error, 0 if no files were found, otherwise
@@ -513,23 +511,26 @@ auditor_iter (void *cls,
* as maybe none of the files were well-formed)
*/
int
-TALER_EXCHANGEDB_auditor_iterate (const char *exchange_base_dir,
+TALER_EXCHANGEDB_auditor_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg,
TALER_EXCHANGEDB_AuditorIterator it,
void *it_cls)
{
- char *dir;
struct AuditorIterateContext aic;
int ret;
+ char *auditor_base_dir;
- GNUNET_asprintf (&dir,
- "%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_AUDITORS,
- exchange_base_dir);
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_filename (cfg,
+ "exchangedb",
+ "AUDITOR_BASE_DIR",
+ &auditor_base_dir))
+ return -1;
aic.it = it;
aic.it_cls = it_cls;
- ret = GNUNET_DISK_directory_scan (dir,
+ ret = GNUNET_DISK_directory_scan (auditor_base_dir,
&auditor_iter,
&aic);
- GNUNET_free (dir);
+ GNUNET_free (auditor_base_dir);
return ret;
}