upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/main/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/config.c')
-rw-r--r--main/config.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/main/config.c b/main/config.c
index 9257397..3e01efc 100644
--- a/main/config.c
+++ b/main/config.c
@@ -20,6 +20,8 @@ esp_err_t tollgate_config_init(void)
20 g_config.ap_max_conn = 4; 20 g_config.ap_max_conn = 4;
21 g_config.price_per_step = 21; 21 g_config.price_per_step = 21;
22 g_config.step_size_ms = 60000; 22 g_config.step_size_ms = 60000;
23 g_config.step_size_bytes = 22020096;
24 strncpy(g_config.metric, "bytes", sizeof(g_config.metric) - 1);
23 g_config.persist_threshold_sats = 1; 25 g_config.persist_threshold_sats = 1;
24 g_config.nostr_publish_interval_s = 21600; 26 g_config.nostr_publish_interval_s = 21600;
25 g_config.client_enabled = false; 27 g_config.client_enabled = false;
@@ -136,6 +138,14 @@ esp_err_t tollgate_config_init(void)
136 cJSON *step = cJSON_GetObjectItem(root, "step_size_ms"); 138 cJSON *step = cJSON_GetObjectItem(root, "step_size_ms");
137 if (step) g_config.step_size_ms = step->valueint; 139 if (step) g_config.step_size_ms = step->valueint;
138 140
141 cJSON *step_bytes = cJSON_GetObjectItem(root, "step_size_bytes");
142 if (step_bytes) g_config.step_size_bytes = step_bytes->valueint;
143
144 cJSON *metric = cJSON_GetObjectItem(root, "metric");
145 if (metric && cJSON_IsString(metric)) {
146 strncpy(g_config.metric, metric->valuestring, sizeof(g_config.metric) - 1);
147 }
148
139 cJSON *persist = cJSON_GetObjectItem(root, "persist_threshold_sats"); 149 cJSON *persist = cJSON_GetObjectItem(root, "persist_threshold_sats");
140 if (persist) g_config.persist_threshold_sats = (uint64_t)persist->valuedouble; 150 if (persist) g_config.persist_threshold_sats = (uint64_t)persist->valuedouble;
141 151