diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2021-09-08 17:09:30 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2021-09-08 17:09:30 +0200 |
commit | 52ed41d588082f2097473b1440fcc314a79dc4c4 (patch) | |
tree | 6057d3f531c5cb22b83ba14455503c1a0c75f7ae | |
parent | 1bc2346a56d486a3557cf524fb38e971b854e6ee (diff) | |
download | sync-52ed41d588082f2097473b1440fcc314a79dc4c4.tar.gz sync-52ed41d588082f2097473b1440fcc314a79dc4c4.tar.bz2 sync-52ed41d588082f2097473b1440fcc314a79dc4c4.zip |
add liability limit to sync /config
-rw-r--r-- | src/sync/sync-httpd.c | 17 | ||||
-rw-r--r-- | src/sync/sync-httpd.h | 7 | ||||
-rw-r--r-- | src/sync/sync-httpd_config.c | 2 | ||||
-rw-r--r-- | src/sync/sync.conf | 3 |
4 files changed, 28 insertions, 1 deletions
diff --git a/src/sync/sync-httpd.c b/src/sync/sync-httpd.c index 3e13c31..0ec95e7 100644 --- a/src/sync/sync-httpd.c +++ b/src/sync/sync-httpd.c @@ -120,6 +120,11 @@ static char *apikey; */ static char *keypass; +/** + * Amount of insurance. + */ +struct TALER_Amount SH_insurance; + /** * A client has requested the given url using the given method @@ -557,6 +562,18 @@ run (void *cls, if (GNUNET_OK != TALER_config_get_amount (config, "sync", + "INSURANCE", + &SH_insurance)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + "sync", + "INSURANCE"); + GNUNET_SCHEDULER_shutdown (); + return; + } + if (GNUNET_OK != + TALER_config_get_amount (config, + "sync", "ANNUAL_FEE", &SH_annual_fee)) { diff --git a/src/sync/sync-httpd.h b/src/sync/sync-httpd.h index c129c7e..c24b67d 100644 --- a/src/sync/sync-httpd.h +++ b/src/sync/sync-httpd.h @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2019 Taler Systems SA + Copyright (C) 2019-2021 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -154,6 +154,11 @@ extern char *SH_fulfillment_url; extern struct GNUNET_CURL_Context *SH_ctx; /** + * Amount of insurance. + */ +extern struct TALER_Amount SH_insurance; + +/** * Kick MHD to run now, to be called after MHD_resume_connection(). * Basically, we need to explicitly resume MHD's event loop whenever * we made progress serving a request. This function re-schedules diff --git a/src/sync/sync-httpd_config.c b/src/sync/sync-httpd_config.c index 91c481c..b75c1d5 100644 --- a/src/sync/sync-httpd_config.c +++ b/src/sync/sync-httpd_config.c @@ -56,6 +56,8 @@ SH_handler_config (struct SH_RequestHandler *rh, "sync"), GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes", SH_upload_limit_mb), + TALER_JSON_pack_amount ("liability_limit", + &SH_insurance), TALER_JSON_pack_amount ("annual_fee", &SH_annual_fee), GNUNET_JSON_pack_string ("version", diff --git a/src/sync/sync.conf b/src/sync/sync.conf index 77f8070..c6b7aa7 100644 --- a/src/sync/sync.conf +++ b/src/sync/sync.conf @@ -28,6 +28,9 @@ DB = postgres # Annual fee for an account ANNUAL_FEE = TESTKUDOS:0.1 +# Insurance provided against loss +INSURANCE = TESTKUDOS:0.0 + # Upload limit per backup, in megabytes UPLOAD_LIMIT_MB = 16 |