Exemplo n.º 1
0
static std::vector<std::string> GetConfig()
{
    std::vector<std::string> result;

    CfgReader reader;
    reader.Read("./Gateway.cfg");
    std::string ip = reader["GatewayIP"];
    std::string port = reader["GatewayPort"];
    std::string pool_size = reader["IoServicePoolSize"];
    if (ip.empty() || port.empty()) {
        LOG("Please check Gateway.cfg!");
        return result;
    }

    if (pool_size.empty()) {
        pool_size = "1";
    }

    result.push_back(ip);
    result.push_back(port);
    result.push_back(pool_size);
    return result;
}
Exemplo n.º 2
0
static DriverStartupConfig GetConfig()
{
    DriverStartupConfig config;

    CfgReader reader;
    reader.Read("./Driver.cfg");
    config.service_name = reader["ServiceName"];
    config.rpc_server_addr = reader["RpcProxyServerAddr"];
    config.gateway_name = reader["GatewayServiceName"];
    std::string pool_size = reader["IoServicePoolSize"];
    if (config.service_name.empty() ||
        config.rpc_server_addr.empty() ||
        config.gateway_name.empty()) {
        printf("Please check the cfg file\n");
        return config;
    }

    if (pool_size.empty()) {
        pool_size = "1";
    }

    config.pool_size = atoi(pool_size.c_str());
    return config;
}