summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd.c
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-01-13 14:44:51 +0100
committerFlorian Dold <florian.dold@gmail.com>2017-01-13 14:44:51 +0100
commit0bfb5b25091a1cbdd9911ae124ae6da35cd2b916 (patch)
tree8a5dddf4b02916bf2d177002acb5514d88e4e64b /src/exchange/taler-exchange-httpd.c
parentc631ae1b600add2ff229102d63870199043feb53 (diff)
downloadexchange-0bfb5b25091a1cbdd9911ae124ae6da35cd2b916.tar.gz
exchange-0bfb5b25091a1cbdd9911ae124ae6da35cd2b916.tar.bz2
exchange-0bfb5b25091a1cbdd9911ae124ae6da35cd2b916.zip
Add option to initialized db, fixes 4858
Additionally remove the TESTRUN option, since the name is confusing and doesn't match the original semantics (temp tables). Test cases should now invoke the exchange httpd with the "-i" option.
Diffstat (limited to 'src/exchange/taler-exchange-httpd.c')
-rw-r--r--src/exchange/taler-exchange-httpd.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index d6dfb0358..f1661b003 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -101,6 +101,11 @@ static struct MHD_Daemon *mhd_admin;
static int no_admin;
/**
+ * Initialize the database by creating tables and indices.
+ */
+static int init_db;
+
+/**
* Port to run the daemon on.
*/
static uint16_t serve_port;
@@ -656,13 +661,10 @@ exchange_serve_process_config ()
TEH_VALIDATION_done ();
return GNUNET_SYSERR;
}
- if (GNUNET_YES ==
- GNUNET_CONFIGURATION_get_value_yesno (cfg,
- "exchange",
- "TESTRUN"))
+ if (0 != init_db)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Running in TEST mode! Database contents will not persist!\n");
+ "Ensuring that tables and indices are created!\n");
TEH_plugin->create_tables (TEH_plugin->cls);
}
@@ -938,6 +940,9 @@ main (int argc,
{'D', "disable-admin", NULL,
"do not run the /admin-HTTP server", 0,
&GNUNET_GETOPT_set_one, &no_admin},
+ {'i', "init-db", NULL,
+ "create database tables and indicies if necessary", 0,
+ &GNUNET_GETOPT_set_one, &init_db},
{'t', "timeout", "SECONDS",
"after how long do connections timeout by default (in seconds)", 1,
&GNUNET_GETOPT_set_uint, &connection_timeout},