diff options
-rw-r--r-- | src/mint/taler-mint-dbinit.c | 34 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd.c | 2 |
2 files changed, 9 insertions, 27 deletions
diff --git a/src/mint/taler-mint-dbinit.c b/src/mint/taler-mint-dbinit.c index 060eabc7b..8056b7df0 100644 --- a/src/mint/taler-mint-dbinit.c +++ b/src/mint/taler-mint-dbinit.c @@ -23,7 +23,7 @@ #include <libpq-fe.h> #include "taler_util.h" #include "taler_mintdb_plugin.h" - +#include "plugin.h" /** * Mint directory with the keys. @@ -35,12 +35,6 @@ static char *mint_base_dir; */ static struct GNUNET_CONFIGURATION_Handle *cfg; -/** - * Database connection handle. - */ -static PGconn *db_conn; - - /** * The main function of the database initialization tool. @@ -61,7 +55,6 @@ main (int argc, &GNUNET_GETOPT_set_filename, &mint_base_dir}, GNUNET_GETOPT_OPTION_END }; - char *db_connection_cfg_str; if (GNUNET_GETOPT_run ("taler-mint-dbinit", options, @@ -78,7 +71,6 @@ main (int argc, "Mint base directory not given.\n"); return 1; } - cfg = TALER_config_load (mint_base_dir); if (NULL == cfg) { @@ -87,32 +79,22 @@ main (int argc, return 1; } if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, - "mint", - "db", - &db_connection_cfg_str)) + TALER_MINT_plugin_load (cfg)) { fprintf (stderr, - "Configuration 'mint.db' not found.\n"); + "Failed to initialize database plugin.\n"); return 1; } - db_conn = PQconnectdb (db_connection_cfg_str); - if (CONNECTION_OK != PQstatus (db_conn)) - { - fprintf (stderr, - "Database connection failed: %s\n", - PQerrorMessage (db_conn)); - free (db_connection_cfg_str); - return 1; - } - free (db_connection_cfg_str); - - if (GNUNET_OK != TALER_MINT_DB_create_tables (GNUNET_NO)) + if (GNUNET_OK != + plugin->create_tables (plugin->cls, + GNUNET_NO)) { fprintf (stderr, "Failed to initialize database.\n"); + TALER_MINT_plugin_unload (); return 1; } + TALER_MINT_plugin_unload (); return 0; } diff --git a/src/mint/taler-mint-httpd.c b/src/mint/taler-mint-httpd.c index 9adf26dfd..70d3b64f0 100644 --- a/src/mint/taler-mint-httpd.c +++ b/src/mint/taler-mint-httpd.c @@ -36,6 +36,7 @@ #include "taler-mint-httpd_refresh.h" #include "taler-mint-httpd_keystate.h" #include "taler_mintdb_plugin.h" +#include "plugin.h" /** @@ -229,7 +230,6 @@ mint_serve_process_config (const char *mint_directory) unsigned long long port; unsigned long long kappa; char *master_pub_str; - char *db_cfg; cfg = TALER_config_load (mint_directory); if (NULL == cfg) |