commit 2b39c6127d011d8a328f4c209fe77fcb8b2601f3
parent a617ef61f2fb5b855054c1fa024b35d1e5708ee9
Author: Tellenbach Reto <tellr1@bfh.ch>
Date: Mon, 18 May 2026 16:44:35 +0200
[new] thinker_TalerAPI: Load Config
Diffstat:
6 files changed, 125 insertions(+), 26 deletions(-)
diff --git a/thinker/taler_api/CMakeLists.txt b/thinker/taler_api/CMakeLists.txt
@@ -1,6 +1,6 @@
# Project Config
cmake_minimum_required(VERSION 3.13)
-project(CoinAcceptor LANGUAGES C )
+project(taler-api LANGUAGES C )
# Langage requirements
set(CMAKE_C_STANDARD 17)
diff --git a/thinker/taler_api/CMakePresets.json b/thinker/taler_api/CMakePresets.json
@@ -1,14 +1,14 @@
{
- "version": 3,
- "configurePresets": [
- {
- "name": "debug",
- "binaryDir": "${sourceDir}/build/debug",
- "cacheVariables": {
- "CMAKE_BUILD_TYPE": "Debug",
- "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
- "CMAKE_C_FLAGS": "-Wall -Wextra"
- }
- }
- ]
-}
+ "version": 3,
+ "configurePresets": [
+ {
+ "name": "debug",
+ "binaryDir": "${sourceDir}/build/debug",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Debug",
+ "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
+ "CMAKE_C_FLAGS": "-Wall -Wextra"
+ }
+ }
+ ]
+}
+\ No newline at end of file
diff --git a/thinker/taler_api/README.md b/thinker/taler_api/README.md
@@ -0,0 +1,3 @@
+# Building
+
+`export TALER_DIGITIZER_PREFIX=<installation_path>`
+\ No newline at end of file
diff --git a/thinker/taler_api/src/taler-digitizer.c b/thinker/taler_api/src/taler-digitizer.c
@@ -18,6 +18,17 @@
*/
static int global_ret;
+/**
+ * Global option '-d' to enable diagnostics set.
+ */
+static int enable_diagnostics;
+
+/**
+ * Taler Backend url read from configuration file
+ */
+static char *backend_base_url;
+
+
struct TALER_DIGITIYER_Config
{
@@ -68,19 +79,106 @@ run (void *cls,
(void) args;
(void) cfgfile;
- printf("GNUNET Client Test\n");
+ printf("Parse Config\n");
- return;
+ if(enable_diagnostics)GNUNET_CONFIGURATION_enable_diagnostics (cfg);
+
+ /* parse the devices, if no config entry is found, a standard is used */
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string(cfg,
+ "taler-digitizer",
+ "BACKEND_BASE_URL",
+ &backend_base_url))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "taler-digitizer",
+ "BACKEND_BASE_URL");
+ global_ret = EXIT_FAILURE;
+ return;
+ }
+
+ printf("Config URl: %s \n", backend_base_url);
}
+ /*
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "taler-mdb",
+ "CURRENCY",
+ &digitizer_currency))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "taler-mdb",
+ "BACKEND_BASE_URL");
+ global_ret = EXIT_FAILURE;
+ return;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "taler-mdb",
+ "BANK_MIN_BALANCE",
+ &backend_min_balance))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "taler-mdb",
+ "BACKEND_BASE_URL");
+ global_ret = EXIT_FAILURE;
+ return;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "taler-mdb",
+ "PERSON_WITHDRAWLLIMIT",
+ &person_withdrawllimit))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "taler-mdb",
+ "BACKEND_BASE_URL");
+ global_ret = EXIT_FAILURE;
+ return;
+ }
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "taler-mdb",
+ "PERSON_WITHDRAL_PERIOD",
+ &person_withdrawl_period))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "taler-mdb",
+ "BACKEND_BASE_URL");
+ global_ret = EXIT_FAILURE;
+ return;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "taler-mdb",
+ "KYC_FUNCTIONALITY",
+ &))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "taler-mdb",
+ "BACKEND_BASE_URL");
+ global_ret = EXIT_FAILURE;
+ return;
+ }
+ return;
+}
+*/
int main(int argc, char*const*argv)
{
int ret;
+
struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_option_flag ('d',
+ "enable-diagnostics",
+ "enable diagnostics for debuging",
+ &enable_diagnostics),
GNUNET_GETOPT_OPTION_END
};
+
ret = GNUNET_PROGRAM_run (TALER_DIGITIZER_project_data (),
argc,
argv,
diff --git a/thinker/taler_api/src/taler_digitizer_util.h b/thinker/taler_api/src/taler_digitizer_util.h
@@ -12,18 +12,14 @@
* Default project data. When shipping use a seperate os_installation.c which sets values at installation.
*/
static const struct GNUNET_OS_ProjectData digitizer_pd = {
- .libname = "libtalerdigitizerutil",
- .project_dirname = "taler-digitizer",
- .binary_name = "taler-digitizer",
- .env_varname = "TALER_DIGITIZER_PREFIX",
- .base_config_varname = "TALER_BASE_CONFIG",
+ .base_config_varname = "TALER_DIGITIZER_PREFIX",
.bug_email = "taler@lists.gnu.org",
.homepage = "http://www.gnu.org/s/taler/",
.config_file = "taler-digitizer.conf",
.user_config_file = "~/.config/taler-digitizer.conf",
.version = "0.1.0",
- .is_gnu = 1,
- .gettext_domain = "taler-digitizer",
+ .is_gnu = 0,
+ .gettext_domain = NULL,
.gettext_path = NULL,
};
diff --git a/thinker/taler_api/taler-digitizer.conf b/thinker/taler_api/taler-digitizer.conf
@@ -1,5 +1,5 @@
[taler-digitizer]
-BACKEND_BASE_URL = https://exchange.demo.taler.net
+BACKEND_BASE_URL = https://exchange.demo.taler.net/
CURRENCY = KUDOS
#BANK_ACCOUNT = sdflksdflsdkjf
@@ -9,8 +9,8 @@ BANK_MIN_BALANCE = 1000
# Withdrawl limitation per person, for a limited time period.
# This can only be enforced with KYC functionality
-WITHDRAWLLIMIT = 200
-PERIOS = 10
+PERSON_WITHDRAWLLIMIT = 200
+PERSON_WITHDRAL_PERIOD = 10
#BACKEND_AUTHORIZATION = Bearer secret-token:sandbox