create a singleton class with below code #define CFG_FILE_PATH "conf/sysinfo.ini"
#define MAX_CFG_PATH_SIZE 4096

std::thread   cfg_thread;
st_cluster_t  cluster;
st_log_mode_t log_mode;
bool          is_thread_exit = false;

static std::string string_trim(const std::string& str)
{
 	size_t first = str.find_first_not_of(' ');
    size_t last  = str.find_last_not_of(' ');
    return str.substr(first, (last - first + 1));
}
void R_Print_ClusterCfg()
{
    printf("Display enable          : %d\n",log_mode.display_enable);
    printf("Current display         : %s\n", cluster.display_param.disp_name);
    printf("Current display  width  : %d\n", cluster.display_param.width);
    printf("Current display  height : %d\n", cluster.display_param.height);
    printf("speedometer x           : %f\n", cluster.speedometer.speedo_x_position);
    printf("speedometer y           : %f\n", cluster.speedometer.speedo_y_position);
    printf("speedometer min         : %d\n", cluster.speedometer.speed_min);
    printf("speedometer max         : %d\n", cluster.speedometer.speed_max);
    printf("speedometer interval    : %d\n", cluster.speedometer.speed_interval);
    printf("tachometer x            : %f\n", cluster.tachometer.tacho_x_position);
    printf("tachometer y            : %f\n", cluster.tachometer.tacho_y_position);
    printf("tachometer min          : %d\n", cluster.tachometer.tacho_min);
    printf("tachometer max          : %d\n", cluster.tachometer.tacho_max);
    printf("tachometer interval     : %d\n", cluster.tachometer.tacho_interval);
    printf("Gear x                  : %f\n", cluster.gearStatus.gear_x_position);
    printf("Gear y                  : %f\n", cluster.gearStatus.gear_y_position);
    printf("Gear value              : %s\n", cluster.gearStatus.gear);
    printf("Gear interval           : %d\n", cluster.gearStatus.gear_interval);
    printf("Odometer_input          : %d\n",cluster.odometer_input);
    printf("Tripmeter_input         : %0.1f\n",cluster.tripmeter_input);
    printf("Tripmeter_reset         : %d\n",cluster.trip_reset);
    printf("Battery level           : %d\n",cluster.battery_level);
    printf("Fuel level              : %d\n",cluster.fuel_value);
    printf("Debug_enable            : %d\n",log_mode.debug_enable);
    printf("Processing time         : %d\n", log_mode.proc_time);
    printf("CPU_load_enable:        : %d\n",log_mode.cpu_load_enable);
}

bool R_Read_ClusterCfg(void)
{

    /* get the current directory path */
    char cur_dir[MAX_CFG_PATH_SIZE];
    char cfg_path[MAX_CFG_PATH_SIZE];

    /* Wrapper for getcwd function for dependency injection */
    auto get_cur_dir = [](char *buf, size_t size)
    {
        return getcwd(buf, size);
    };

    if (get_cur_dir(cur_dir, sizeof(cur_dir)) == NULL)
    {

        return false;
    }

    snprintf(cfg_path, sizeof(cfg_path), "%s/%s", cur_dir, CFG_FILE_PATH);

    std::ifstream file(cfg_path);
    if (!file.is_open())
    {
        std::cerr << "Failed to open the .ini file." << std::endl;
        file.close();
        return false;
    }
    else
    {
        std::map<std::string, std::map<std::string, std::string>> ini_data;
        std::string current_section;

        std::string line;
        while (std::getline(file, line))
        {

            if (line.empty() || line[0] == ';')
            {
                // Skip empty lines and comments.
                continue;
            }
            else if (line[0] == '[' && line[line.length() - 1] == ']')
            {
                // Found a section.
                current_section = line.substr(1, line.length() - 2);
            }
            else
            {
                // Found a key-value pair.
                size_t delimiter_pos = line.find('=');
                if (delimiter_pos != std::string::npos)
                {
                    std::string key = string_trim(line.substr(0, delimiter_pos));
                    std::string value = string_trim(line.substr(delimiter_pos + 1));
                    ini_data[current_section][key] = value;
                }
            }
        }

        // Accessing values from the .ini file.
        for (const auto &section : ini_data)
        {
            if (section.first == "Display")
            {
                for (const auto &entry : section.second)
                {
                    if (entry.first == "display")
                        log_mode.display_enable = stoi(entry.second);
                }
            }
            else if (section.first == "HomeDisplay")
            {
                for (const auto &entry : section.second)
                {
                    if (entry.first == "name")
                        sprintf(cluster.display_param.disp_name, (entry.second).c_str());
                    if (entry.first == "width")
                        cluster.display_param.width = stoi(entry.second);
                    if (entry.first == "height")
                        cluster.display_param.height = stoi(entry.second);
                }
            }
            else if (section.first == "Speedometer")
            {
                for (const auto &entry : section.second)
                {

                    if (entry.first == "speed_min")
                        cluster.speedometer.speed_min = stoi(entry.second);
                    if (entry.first == "speed_max")
                        cluster.speedometer.speed_max = stoi(entry.second);
                    if (entry.first == "speed_interval")
                        cluster.speedometer.speed_interval = stoi(entry.second);
                    if (entry.first == "speedo_x_position")
                        cluster.speedometer.speedo_x_position = stof(entry.second);
                    if (entry.first == "speedo_y_position")
                        cluster.speedometer.speedo_y_position = stof(entry.second);
                }
            }
            else if (section.first == "Tachometer")
            {
                for (const auto &entry : section.second)
                {

                    if (entry.first == "tacho_min")
                        cluster.tachometer.tacho_min = stoi(entry.second);
                    if (entry.first == "tacho_max")
                        cluster.tachometer.tacho_max = stoi(entry.second);
                    if (entry.first == "tacho_interval")
                        cluster.tachometer.tacho_interval = stoi(entry.second);
                    if (entry.first == "tacho_x_position")
                        cluster.tachometer.tacho_x_position = stof(entry.second);
                    if (entry.first == "tacho_y_position")
                        cluster.tachometer.tacho_y_position = stof(entry.second);
                }
            }
            else if (section.first == "GearStatus")
            {
                for (const auto &entry : section.second)
                {
                    if (entry.first == "gear_interval")
                        cluster.gearStatus.gear_interval = stoi(entry.second);
                    if (entry.first == "gear_x_position")
                        cluster.gearStatus.gear_x_position = stof(entry.second);
                    if (entry.first == "gear_y_position")
                        cluster.gearStatus.gear_y_position = stof(entry.second);
                    if (entry.first == "gear")
                    {
                        if (entry.second == "D")
                            sprintf(cluster.gearStatus.gear, (entry.second).c_str());
                        else if (entry.second == "N")
                            sprintf(cluster.gearStatus.gear, (entry.second).c_str());
                        else if (entry.second == "R")
                            sprintf(cluster.gearStatus.gear, (entry.second).c_str());
                        else if (entry.second == "P")
                            sprintf(cluster.gearStatus.gear, (entry.second).c_str());
                        else
                            sprintf(cluster.gearStatus.gear, "Err");
                    }
                }
            }
            else if (section.first == "Odometer")
            {
                for (const auto &entry : section.second)
                {
                    if (entry.first == "odometer_input")
                        cluster.odometer_input = stol(entry.second);
                }
            }
            else if (section.first == "Tripmeter")
            {
                for (const auto &entry : section.second)
                {
                    if (entry.first == "tripmeter_input")
                        cluster.tripmeter_input = stof(entry.second);
                    if (entry.first == "reset")
                        cluster.trip_reset = stoi(entry.second);
                }
            }
            else if (section.first == "Battery")
            {
                for (const auto &entry : section.second)
                {
                    if (entry.first == "battery_level")
                        cluster.battery_level = stoi(entry.second);
                }
            }
            else if (section.first == "Fuelmeter")
            {
                for (const auto &entry : section.second)
                {
                    if (entry.first == "fuel_value")
                        cluster.fuel_value = stoi(entry.second);
                }
            }
            else if (section.first == "Debug")
            {
                for (const auto &entry : section.second)
                {
                    if (entry.first == "debug_enable")
                        log_mode.debug_enable = stoi(entry.second);
                    if (entry.first == "proc_time")
                        log_mode.proc_time = stof(entry.second);
                }
            }
            else if (section.first == "CPU")
            {
                for (const auto &entry : section.second)
                {
                    if (entry.first == "cpu_load_enable")
                        log_mode.cpu_load_enable = stoi(entry.second);
                }
            }
        }

        file.close();
        return true;
    }
}