do not use hard coded database string
This commit is contained in:
parent
42dcf052d1
commit
5faa541d27
@ -59,11 +59,13 @@ append (struct curl_slist *hdr,
|
|||||||
/**
|
/**
|
||||||
* Build authentication header from @a auth.
|
* Build authentication header from @a auth.
|
||||||
*
|
*
|
||||||
* @param auth authentication data to use
|
* @param auth authentication data to use.
|
||||||
* @return NULL on error, otherwise curl headers to use
|
*
|
||||||
|
* @return NULL on error, otherwise curl headers to use.
|
||||||
*/
|
*/
|
||||||
struct curl_slist *
|
struct curl_slist *
|
||||||
TALER_BANK_make_auth_header_ (const struct TALER_BANK_AuthenticationData *auth)
|
TALER_BANK_make_auth_header_
|
||||||
|
(const struct TALER_BANK_AuthenticationData *auth)
|
||||||
{
|
{
|
||||||
struct curl_slist *authh;
|
struct curl_slist *authh;
|
||||||
|
|
||||||
@ -89,9 +91,11 @@ TALER_BANK_make_auth_header_ (const struct TALER_BANK_AuthenticationData *auth)
|
|||||||
/**
|
/**
|
||||||
* Obtain the URL to use for an API request.
|
* Obtain the URL to use for an API request.
|
||||||
*
|
*
|
||||||
* @param u base URL of the bank
|
* @param u base URL of the bank.
|
||||||
* @param path Taler API path (i.e. "/history")
|
* @param path Taler API path (i.e. "/history").
|
||||||
* @return the full URL to use with cURL
|
*
|
||||||
|
* @return the full URL to use with cURL, must be
|
||||||
|
* freed by the caller.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
TALER_BANK_path_to_url_ (const char *u,
|
TALER_BANK_path_to_url_ (const char *u,
|
||||||
@ -114,8 +118,9 @@ TALER_BANK_path_to_url_ (const char *u,
|
|||||||
/**
|
/**
|
||||||
* Parse error code given in @a json.
|
* Parse error code given in @a json.
|
||||||
*
|
*
|
||||||
* @param json the json to parse
|
* @param json the json to parse.
|
||||||
* @return error code, or #TALER_EC_INVALID if not found
|
*
|
||||||
|
* @return error code, or #TALER_EC_INVALID if not found.
|
||||||
*/
|
*/
|
||||||
enum TALER_ErrorCode
|
enum TALER_ErrorCode
|
||||||
TALER_BANK_parse_ec_ (const json_t *json)
|
TALER_BANK_parse_ec_ (const json_t *json)
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
#include <gnunet/gnunet_util_lib.h>
|
#include <gnunet/gnunet_util_lib.h>
|
||||||
#include "taler_testing_bank_lib.h"
|
#include "taler_testing_bank_lib.h"
|
||||||
|
|
||||||
/* Keeps each bank account credential at bank account number - 1 */
|
/* Keep each bank account credentials at index:
|
||||||
|
* bank account number - 1 */
|
||||||
struct TALER_BANK_AuthenticationData AUTHS[] = {
|
struct TALER_BANK_AuthenticationData AUTHS[] = {
|
||||||
|
|
||||||
/* Bank credentials */
|
/* Bank credentials */
|
||||||
@ -52,6 +53,8 @@ struct TALER_BANK_AuthenticationData AUTHS[] = {
|
|||||||
* bank" function to do such tasks.
|
* bank" function to do such tasks.
|
||||||
*
|
*
|
||||||
* @param config_filename configuration filename.
|
* @param config_filename configuration filename.
|
||||||
|
* @param bank_url base URL of the bank, used by `wget' to check
|
||||||
|
* that the bank was started right.
|
||||||
*
|
*
|
||||||
* @return the process, or NULL if the process could not
|
* @return the process, or NULL if the process could not
|
||||||
* be started.
|
* be started.
|
||||||
@ -60,10 +63,6 @@ struct GNUNET_OS_Process *
|
|||||||
TALER_TESTING_run_bank (const char *config_filename,
|
TALER_TESTING_run_bank (const char *config_filename,
|
||||||
const char *bank_url)
|
const char *bank_url)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* to fetch: dbname+serving_method+base_url */
|
|
||||||
|
|
||||||
|
|
||||||
struct GNUNET_OS_Process *bank_proc;
|
struct GNUNET_OS_Process *bank_proc;
|
||||||
unsigned int iter;
|
unsigned int iter;
|
||||||
char *wget_cmd;
|
char *wget_cmd;
|
||||||
@ -160,9 +159,10 @@ TALER_TESTING_run_bank (const char *config_filename,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare the bank execution. Check if the port is available
|
* Prepare the bank execution. Check if the port is available
|
||||||
* (and reset database?).
|
* and reset database.
|
||||||
*
|
*
|
||||||
* @param config_filename configuration filename.
|
* @param config_filename configuration filename.
|
||||||
*
|
*
|
||||||
@ -178,6 +178,7 @@ TALER_TESTING_prepare_bank (const char *config_filename)
|
|||||||
enum GNUNET_OS_ProcessStatusType type;
|
enum GNUNET_OS_ProcessStatusType type;
|
||||||
unsigned long code;
|
unsigned long code;
|
||||||
char *base_url;
|
char *base_url;
|
||||||
|
char *database;
|
||||||
|
|
||||||
cfg = GNUNET_CONFIGURATION_create ();
|
cfg = GNUNET_CONFIGURATION_create ();
|
||||||
|
|
||||||
@ -185,6 +186,16 @@ TALER_TESTING_prepare_bank (const char *config_filename)
|
|||||||
(cfg, config_filename))
|
(cfg, config_filename))
|
||||||
BANK_FAIL ();
|
BANK_FAIL ();
|
||||||
|
|
||||||
|
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string
|
||||||
|
(cfg, "bank", "DATABASE", &database))
|
||||||
|
{
|
||||||
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
|
"bank",
|
||||||
|
"DATABASE");
|
||||||
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
|
BANK_FAIL ();
|
||||||
|
}
|
||||||
|
|
||||||
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number
|
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number
|
||||||
(cfg, "bank", "HTTP_PORT", &port))
|
(cfg, "bank", "HTTP_PORT", &port))
|
||||||
{
|
{
|
||||||
@ -214,7 +225,7 @@ TALER_TESTING_prepare_bank (const char *config_filename)
|
|||||||
"taler-bank-manage",
|
"taler-bank-manage",
|
||||||
"taler-bank-manage",
|
"taler-bank-manage",
|
||||||
"-c", "bank.conf",
|
"-c", "bank.conf",
|
||||||
"--with-db=postgres:///talercheck", /*FIXME: no hardcoded*/
|
"--with-db", database, /*FIXME: no hardcoded*/
|
||||||
"django",
|
"django",
|
||||||
"flush",
|
"flush",
|
||||||
"--no-input", NULL)))
|
"--no-input", NULL)))
|
||||||
|
Loading…
Reference in New Issue
Block a user