bool service_app_spec::init( const char* section, const char* role_name_, service_app_spec* default_value, network_client_configs* default_client_nets, network_server_configs* default_server_nets ) { id = 0; index = 0; role_name = std::string(role_name_); name = role_name; config_section = std::string(section); if (!read_config(section, *this, default_value)) return false; std::sort(ports.begin(), ports.end()); ports_gap = ports.size() > 0 ? (*ports.rbegin() + 1 - *ports.begin()) : 0; if (!build_client_network_confs( section, this->network_client_confs, default_value ? &default_value->network_client_confs : default_client_nets )) return false; if (!build_server_network_confs( section, this->network_server_confs, default_value ? &default_value->network_server_confs : default_server_nets, ports, default_value == nullptr )) return false; return true; }
bool service_app_spec::init( const char* section, const char* r, configuration_ptr& config, service_app_spec* default_value, network_client_configs* default_client_nets, network_server_configs* default_server_nets ) { id = 0; index = 0; role = r; config_section = std::string(section); if (!read_config(config, section, *this, default_value)) return false; std::sort(ports.begin(), ports.end()); if (!build_client_network_confs( section, config, this->network_client_confs, default_value ? &default_value->network_client_confs : default_client_nets )) return false; return build_server_network_confs( section, config, this->network_server_confs, default_value ? &default_value->network_server_confs : default_server_nets, ports, default_value == nullptr ); }