commit 80593b30389c7376bebc6e205f44ab0a4f4b8372
parent 929815f1630d7b3d19f8b6c2abb27bbb35d754fb
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date: Fri, 5 Jan 2024 13:09:00 +0100
rename
Diffstat:
8 files changed, 165 insertions(+), 165 deletions(-)
diff --git a/contrib/donau-dbconfig b/contrib/donau-dbconfig
@@ -0,0 +1,137 @@
+#!/bin/bash
+# This file is part of GNU TALER.
+# Copyright (C) 2023 Taler Systems SA
+#
+# TALER is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free Software
+# Foundation; either version 2.1, or (at your option) any later version.
+#
+# TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License along with
+# TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+#
+# @author Christian Grothoff
+#
+#
+# Error checking on
+set -eu
+
+RESET_DB=0
+SKIP_DBINIT=0
+DBUSER="donau-httpd"
+DBGROUP="donau-db"
+DBNAME="donau"
+CFGFILE="/etc/taler/secrets/donau-db.secret.conf"
+
+# Parse command-line options
+while getopts ':g:hn:rsu:' OPTION; do
+ case "$OPTION" in
+ h)
+ echo 'Supported options:'
+ echo " -c FILENAME -- write configuration to FILENAME (default: $CFGFILE)"
+ echo " -g GROUP -- donau to be run by GROUP (default: $DBGROUP)"
+ echo " -h -- print this help text"
+ echo " -n NAME -- user NAME for database name (default: $DBNAME)"
+ echo " -r -- reset database (dangerous)"
+ echo " -s -- skip database initialization"
+ echo " -u USER -- donau to be run by USER (default: $DBUSER)"
+ exit 0
+ ;;
+ n)
+ DBNAME="$OPTARG"
+ ;;
+ r)
+ RESET_DB="1"
+ ;;
+ s)
+ SKIP_DBINIT="1"
+ ;;
+ u)
+ DBUSER="$OPTARG"
+ ;;
+ ?)
+ exit_fail "Unrecognized command line option"
+ ;;
+ esac
+done
+
+if ! id postgres > /dev/null
+then
+ echo "Could not find 'postgres' user. Please install Postgresql first"
+ exit 1
+fi
+
+if [ "$(id -u)" -ne 0 ]
+then
+ echo "This script must be run as root"
+ exit 1
+fi
+
+if [ 0 = "$SKIP_DBINIT" ]
+then
+ if ! donau-dbinit -v 2> /dev/null
+ then
+ echo "Required 'donau-dbinit' not found. Please fix your installation."
+ fi
+fi
+
+if ! id "$DBUSER" > /dev/null
+then
+ echo "Could not find '$DBUSER' user. Please set it up first"
+ exit 1
+fi
+
+if sudo -i -u postgres psql "$DBNAME" < /dev/null 2> /dev/null
+then
+ if [ 1 = "$RESET_DB" ]
+ then
+ echo "Deleting existing database '$DBNAME'." 1>&2
+ sudo -i -u postgres dropdb "$DBNAME"
+ else
+ echo "Database '$DBNAME' already exists, refusing to setup again."
+ echo "Use -r to delete the existing database first (dangerous!)."
+ exit 77
+ fi
+fi
+
+echo "Setting up database user '$DBUSER'." 1>&2
+
+if ! sudo -i -u postgres createuser "$DBUSER" 2> /dev/null
+then
+ echo "Database user '$DBUSER' already existed. Continuing anyway." 1>&2
+fi
+
+echo "Creating database '$DBNAME'." 1>&2
+
+if ! sudo -i -u postgres createdb -O "$DBUSER" "$DBNAME"
+then
+ echo "Failed to create database '$DBNAME'"
+ exit 1
+fi
+
+if [ -f "$CFGFILE" ]
+then
+ echo "Adding database configuration to '$CFGFILE'." 1>&2
+ echo -e "[donaudb-postgres]\nCONFIG=postgres:///$DBNAME\n" >> "$CFGFILE"
+ chown root:"$DBGROUP" "$CFGFILE"
+ chmod 640 "$CFGFILE"
+else
+ echo "Configuration '$CFGFILE' does not yet exist, creating it." 1>&2
+ mkdir -p "$(dirname "$CFGFILE")"
+ echo -e "[donaudb-postgres]\nCONFIG=postgres:///$DBNAME\n" >> "$CFGFILE"
+ chown root:"$DBGROUP" "$CFGFILE"
+ chmod 640 "$CFGFILE"
+fi
+
+if [ 0 = "$SKIP_DBINIT" ]
+then
+ echo "Initializing database '$DBNAME'." 1>&2
+ sudo -u "$DBUSER" donau-dbinit
+fi
+
+echo "Database configuration finished." 1>&2
+
+exit 0
diff --git a/contrib/taler-donau-dbconfig b/contrib/taler-donau-dbconfig
@@ -1,137 +0,0 @@
-#!/bin/bash
-# This file is part of GNU TALER.
-# Copyright (C) 2023 Taler Systems SA
-#
-# TALER is free software; you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free Software
-# Foundation; either version 2.1, or (at your option) any later version.
-#
-# TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along with
-# TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-#
-# @author Christian Grothoff
-#
-#
-# Error checking on
-set -eu
-
-RESET_DB=0
-SKIP_DBINIT=0
-DBUSER="taler-donau-httpd"
-DBGROUP="taler-donau-db"
-DBNAME="donau"
-CFGFILE="/etc/taler/secrets/donau-db.secret.conf"
-
-# Parse command-line options
-while getopts ':g:hn:rsu:' OPTION; do
- case "$OPTION" in
- h)
- echo 'Supported options:'
- echo " -c FILENAME -- write configuration to FILENAME (default: $CFGFILE)"
- echo " -g GROUP -- taler-donau to be run by GROUP (default: $DBGROUP)"
- echo " -h -- print this help text"
- echo " -n NAME -- user NAME for database name (default: $DBNAME)"
- echo " -r -- reset database (dangerous)"
- echo " -s -- skip database initialization"
- echo " -u USER -- taler-donau to be run by USER (default: $DBUSER)"
- exit 0
- ;;
- n)
- DBNAME="$OPTARG"
- ;;
- r)
- RESET_DB="1"
- ;;
- s)
- SKIP_DBINIT="1"
- ;;
- u)
- DBUSER="$OPTARG"
- ;;
- ?)
- exit_fail "Unrecognized command line option"
- ;;
- esac
-done
-
-if ! id postgres > /dev/null
-then
- echo "Could not find 'postgres' user. Please install Postgresql first"
- exit 1
-fi
-
-if [ "$(id -u)" -ne 0 ]
-then
- echo "This script must be run as root"
- exit 1
-fi
-
-if [ 0 = "$SKIP_DBINIT" ]
-then
- if ! taler-donau-dbinit -v 2> /dev/null
- then
- echo "Required 'taler-donau-dbinit' not found. Please fix your installation."
- fi
-fi
-
-if ! id "$DBUSER" > /dev/null
-then
- echo "Could not find '$DBUSER' user. Please set it up first"
- exit 1
-fi
-
-if sudo -i -u postgres psql "$DBNAME" < /dev/null 2> /dev/null
-then
- if [ 1 = "$RESET_DB" ]
- then
- echo "Deleting existing database '$DBNAME'." 1>&2
- sudo -i -u postgres dropdb "$DBNAME"
- else
- echo "Database '$DBNAME' already exists, refusing to setup again."
- echo "Use -r to delete the existing database first (dangerous!)."
- exit 77
- fi
-fi
-
-echo "Setting up database user '$DBUSER'." 1>&2
-
-if ! sudo -i -u postgres createuser "$DBUSER" 2> /dev/null
-then
- echo "Database user '$DBUSER' already existed. Continuing anyway." 1>&2
-fi
-
-echo "Creating database '$DBNAME'." 1>&2
-
-if ! sudo -i -u postgres createdb -O "$DBUSER" "$DBNAME"
-then
- echo "Failed to create database '$DBNAME'"
- exit 1
-fi
-
-if [ -f "$CFGFILE" ]
-then
- echo "Adding database configuration to '$CFGFILE'." 1>&2
- echo -e "[donaudb-postgres]\nCONFIG=postgres:///$DBNAME\n" >> "$CFGFILE"
- chown root:"$DBGROUP" "$CFGFILE"
- chmod 640 "$CFGFILE"
-else
- echo "Configuration '$CFGFILE' does not yet exist, creating it." 1>&2
- mkdir -p "$(dirname "$CFGFILE")"
- echo -e "[donaudb-postgres]\nCONFIG=postgres:///$DBNAME\n" >> "$CFGFILE"
- chown root:"$DBGROUP" "$CFGFILE"
- chmod 640 "$CFGFILE"
-fi
-
-if [ 0 = "$SKIP_DBINIT" ]
-then
- echo "Initializing database '$DBNAME'." 1>&2
- sudo -u "$DBUSER" taler-donau-dbinit
-fi
-
-echo "Database configuration finished." 1>&2
-
-exit 0
diff --git a/src/donau-tools/donau-dbinit.c b/src/donau-tools/donau-dbinit.c
@@ -116,23 +116,23 @@ run (void *cls,
global_ret = EXIT_NOPERMISSION;
return;
}
- //if (clear_shards)
- //{
+ // if (clear_shards)
+ // {
// if (GNUNET_OK !=
// plugin->delete_shard_locks (plugin->cls))
// {
// fprintf (stderr,
// "Clearing revolving shards failed!\n");
// }
- //}
- //if (gc_db)
- //{
+ // }
+ // if (gc_db)
+ // {
// if (GNUNET_SYSERR == plugin->gc (plugin->cls))
// {
// fprintf (stderr,
// "Garbage collection failed!\n");
// }
- //}
+ // }
}
DONAUDB_plugin_unload (plugin);
plugin = NULL;
diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c
@@ -809,11 +809,11 @@ do_shutdown (void *cls)
MHD_stop_daemon (mhd);
mhd = NULL;
}
- //if (NULL != DH_plugin)
- //{
+ // if (NULL != DH_plugin)
+ // {
// DONAUDB_plugin_unload (DH_plugin);
// DH_plugin = NULL;
- //}
+ // }
if (NULL != DH_curl_ctx)
{
GNUNET_CURL_fini (DH_curl_ctx);
diff --git a/src/donau/donau-httpd_db.c b/src/donau/donau-httpd_db.c
@@ -39,9 +39,9 @@ DH_DB_run_transaction (struct MHD_Connection *connection,
{
if (NULL != mhd_ret)
*mhd_ret = -1; /* set to invalid value, to help detect bugs */
- //if (GNUNET_OK !=
+ // if (GNUNET_OK !=
// DH_plugin->preflight (DH_plugin->cls))
- //{
+ // {
// GNUNET_break (0);
// if (NULL != mhd_ret)
// *mhd_ret = TALER_MHD_reply_with_error (connection,
@@ -49,7 +49,7 @@ DH_DB_run_transaction (struct MHD_Connection *connection,
// TALER_EC_GENERIC_DB_SETUP_FAILED,
// NULL);
// return GNUNET_SYSERR;
- //}
+ // }
GNUNET_assert (mt < DH_MT_REQUEST_COUNT);
DH_METRICS_num_requests[mt]++;
for (unsigned int retries = 0;
@@ -58,10 +58,10 @@ DH_DB_run_transaction (struct MHD_Connection *connection,
{
enum GNUNET_DB_QueryStatus qs;
- //if (GNUNET_OK !=
+ // if (GNUNET_OK !=
// DH_plugin->start (DH_plugin->cls,
// name))
- //{
+ // {
// GNUNET_break (0);
// if (NULL != mhd_ret)
// *mhd_ret = TALER_MHD_reply_with_error (connection,
@@ -69,18 +69,18 @@ DH_DB_run_transaction (struct MHD_Connection *connection,
// TALER_EC_GENERIC_DB_START_FAILED,
// NULL);
// return GNUNET_SYSERR;
- //}
+ // }
qs = cb (cb_cls,
connection,
mhd_ret);
- //if (0 > qs)
- //{
+ // if (0 > qs)
+ // {
// DH_plugin->rollback (DH_plugin->cls);
// if (GNUNET_DB_STATUS_HARD_ERROR == qs)
// return GNUNET_SYSERR;
- //}
- //else
- //{
+ // }
+ // else
+ // {
// qs = DH_plugin->commit (DH_plugin->cls);
// if (GNUNET_DB_STATUS_HARD_ERROR == qs)
// {
@@ -94,7 +94,7 @@ DH_DB_run_transaction (struct MHD_Connection *connection,
// }
// if (0 > qs)
// DH_plugin->rollback (DH_plugin->cls);
- //}
+ // }
if (0 <= qs)
return GNUNET_OK;
DH_METRICS_num_conflict[mt]++;
diff --git a/src/donau/donau-httpd_db.h b/src/donau/donau-httpd_db.h
@@ -22,7 +22,7 @@
#define DONAU_HTTPD_DB_H
#include <microhttpd.h>
-//#include "donaudb_plugin.h"
+// #include "donaudb_plugin.h"
#include "donau-httpd_metrics.h"
#include <gnunet/gnunet_mhd_compat.h>
diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c
@@ -710,16 +710,16 @@ build_key_state (struct HelperState *hs,
false /* MUST be false! */
);
/* NOTE: fetches master-signed signkeys, but ALSO those that were revoked! */
- //GNUNET_break (GNUNET_OK ==
+ // GNUNET_break (GNUNET_OK ==
// DH_plugin->preflight (DH_plugin->cls));
- //if (qs < 0)
- //{
+ // if (qs < 0)
+ // {
// GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
// GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs);
// destroy_key_state (ksh,
// true);
// return NULL;
- //}
+ // }
// qs = DH_plugin->iterate_denominations (DH_plugin->cls,
// &denomination_info_cb,
// ksh);
diff --git a/src/include/donau_service.h b/src/include/donau_service.h
@@ -790,12 +790,12 @@ struct CharitySummary
/**
* Max donation amout for this charitiy and year.
*/
- struct TALER_Amount max_per_year;
+ struct TALER_Amount max_per_year;
/**
* Current donation amount for this charity and year.
*/
- struct TALER_Amount receipts_to_date;
+ struct TALER_Amount receipts_to_date;
};