diff options
Diffstat (limited to 'main/config.c')
| -rw-r--r-- | main/config.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/main/config.c b/main/config.c index 47d631f..c074410 100644 --- a/main/config.c +++ b/main/config.c | |||
| @@ -22,6 +22,10 @@ esp_err_t tollgate_config_init(void) | |||
| 22 | g_config.step_size_ms = 60000; | 22 | g_config.step_size_ms = 60000; |
| 23 | g_config.persist_threshold_sats = 1; | 23 | g_config.persist_threshold_sats = 1; |
| 24 | g_config.nostr_publish_interval_s = 21600; | 24 | g_config.nostr_publish_interval_s = 21600; |
| 25 | g_config.client_enabled = false; | ||
| 26 | g_config.client_steps_to_buy = 1; | ||
| 27 | g_config.client_renewal_threshold_pct = 20; | ||
| 28 | g_config.client_retry_interval_ms = 30000; | ||
| 25 | 29 | ||
| 26 | esp_vfs_spiffs_conf_t conf = { | 30 | esp_vfs_spiffs_conf_t conf = { |
| 27 | .base_path = "/spiffs", | 31 | .base_path = "/spiffs", |
| @@ -49,7 +53,11 @@ esp_err_t tollgate_config_init(void) | |||
| 49 | "\"step_size_ms\":60000," | 53 | "\"step_size_ms\":60000," |
| 50 | "\"nostr_geohash\":\"u281w0dfz\"," | 54 | "\"nostr_geohash\":\"u281w0dfz\"," |
| 51 | "\"nostr_relays\":[\"wss://relay.damus.io\",\"wss://nos.lol\"]," | 55 | "\"nostr_relays\":[\"wss://relay.damus.io\",\"wss://nos.lol\"]," |
| 52 | "\"nostr_publish_interval_s\":21600" | 56 | "\"nostr_publish_interval_s\":21600," |
| 57 | "\"client_enabled\":false," | ||
| 58 | "\"client_steps_to_buy\":1," | ||
| 59 | "\"client_renewal_threshold_pct\":20," | ||
| 60 | "\"client_retry_interval_ms\":30000" | ||
| 53 | "}"; | 61 | "}"; |
| 54 | f = fopen("/spiffs/config.json", "w"); | 62 | f = fopen("/spiffs/config.json", "w"); |
| 55 | if (f) { | 63 | if (f) { |
| @@ -146,6 +154,18 @@ esp_err_t tollgate_config_init(void) | |||
| 146 | cJSON *pub_interval = cJSON_GetObjectItem(root, "nostr_publish_interval_s"); | 154 | cJSON *pub_interval = cJSON_GetObjectItem(root, "nostr_publish_interval_s"); |
| 147 | if (pub_interval) g_config.nostr_publish_interval_s = pub_interval->valueint; | 155 | if (pub_interval) g_config.nostr_publish_interval_s = pub_interval->valueint; |
| 148 | 156 | ||
| 157 | cJSON *client_enabled = cJSON_GetObjectItem(root, "client_enabled"); | ||
| 158 | if (client_enabled && cJSON_IsBool(client_enabled)) g_config.client_enabled = cJSON_IsTrue(client_enabled); | ||
| 159 | |||
| 160 | cJSON *client_steps = cJSON_GetObjectItem(root, "client_steps_to_buy"); | ||
| 161 | if (client_steps) g_config.client_steps_to_buy = client_steps->valueint; | ||
| 162 | |||
| 163 | cJSON *client_renewal = cJSON_GetObjectItem(root, "client_renewal_threshold_pct"); | ||
| 164 | if (client_renewal) g_config.client_renewal_threshold_pct = client_renewal->valueint; | ||
| 165 | |||
| 166 | cJSON *client_retry = cJSON_GetObjectItem(root, "client_retry_interval_ms"); | ||
| 167 | if (client_retry) g_config.client_retry_interval_ms = client_retry->valueint; | ||
| 168 | |||
| 149 | cJSON_Delete(root); | 169 | cJSON_Delete(root); |
| 150 | 170 | ||
| 151 | if (g_config.nostr_relay_count == 0) { | 171 | if (g_config.nostr_relay_count == 0) { |