2021-08-22 01:51:37 +02:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief The default HTTP 429 (too many requests) wait time
|
|
|
|
*/
|
|
|
|
#define DEFAULT_HTTP_WAIT_SEC 5
|
|
|
|
/**
|
|
|
|
* \brief Data file block size
|
|
|
|
* \details We set it to 1024*1024*8 = 8MiB
|
|
|
|
*/
|
|
|
|
#define DEFAULT_DATA_BLKSZ 8*1024*1024
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Maximum segment block count
|
|
|
|
* \details This is set to 128*1024 blocks, which uses 128KB. By default,
|
|
|
|
* this allows the user to store (128*1024)*(8*1024*1024) = 1TB of data
|
|
|
|
*/
|
|
|
|
#define DEFAULT_MAX_SEGBC 128*1024
|
|
|
|
|
|
|
|
ConfigStruct CONFIG;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \note The opening curly bracket should be at line 39, so the code lines up
|
|
|
|
* with the definition code in util.h.
|
|
|
|
*/
|
|
|
|
void Config_init(void)
|
|
|
|
{
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.mode = NORMAL;
|
2021-08-29 23:46:24 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.log_type = log_level_init();
|
2021-08-29 23:46:24 +02:00
|
|
|
|
2021-08-22 01:51:37 +02:00
|
|
|
/*---------------- Network related --------------*/
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.http_username = NULL;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.http_password = NULL;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.proxy = NULL;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.proxy_username = NULL;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.proxy_password = NULL;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.max_conns = DEFAULT_NETWORK_MAX_CONNS;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.user_agent = DEFAULT_USER_AGENT;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.http_wait_sec = DEFAULT_HTTP_WAIT_SEC;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.no_range_check = 0;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.insecure_tls = 0;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
|
|
|
/*--------------- Cache related ---------------*/
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.cache_enabled = 0;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.cache_dir = NULL;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.data_blksz = DEFAULT_DATA_BLKSZ;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.max_segbc = DEFAULT_MAX_SEGBC;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
|
|
|
/*-------------- Sonic related -------------*/
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.sonic_username = NULL;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.sonic_password = NULL;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.sonic_id3 = 0;
|
2021-08-22 01:51:37 +02:00
|
|
|
|
2021-08-31 12:18:39 +02:00
|
|
|
CONFIG.sonic_insecure = 0;
|
2021-08-31 15:00:47 +02:00
|
|
|
|
|
|
|
/*---------- Print version number -----------*/
|
|
|
|
print_version();
|
2021-08-30 12:24:32 +02:00
|
|
|
}
|