| 496 | // Therefore it checks only the necessary settings. |
| 497 | |
| 498 | void Config::enumerate(ReplicaList& replicas) |
| 499 | { |
| 500 | PathName dbName; |
| 501 | FbLocalStatus localStatus; |
| 502 | |
| 503 | try |
| 504 | { |
| 505 | const PathName filename = |
| 506 | fb_utils::getPrefix(IConfigManager::DIR_CONF, REPLICATION_CFGFILE); |
| 507 | |
| 508 | ConfigFile cfgFile(filename, ConfigFile::HAS_SUB_CONF | |
| 509 | ConfigFile::NATIVE_ORDER | |
| 510 | ConfigFile::CUSTOM_MACROS); |
| 511 | |
| 512 | AutoPtr<Config> defConfig(FB_NEW Config); |
| 513 | |
| 514 | bool defaultFound = false; |
| 515 | |
| 516 | for (const auto& section : cfgFile.getParameters()) |
| 517 | { |
| 518 | if (section.name != "database") |
| 519 | continue; |
| 520 | |
| 521 | AutoPtr<Config> dbConfig; |
| 522 | Config* config = nullptr; |
| 523 | |
| 524 | dbName = section.value.c_str(); |
| 525 | |
| 526 | if (dbName.empty()) |
| 527 | { |
| 528 | if (defaultFound) |
| 529 | raiseError("Only one default DATABASE section is allowed"); |
| 530 | |
| 531 | defaultFound = true; |
| 532 | config = defConfig; |
| 533 | } |
| 534 | else |
| 535 | { |
| 536 | config = dbConfig = FB_NEW Config(*defConfig); |
| 537 | } |
| 538 | |
| 539 | if (!section.sub) |
| 540 | continue; |
| 541 | |
| 542 | for (const auto& el : section.sub->getParameters()) |
| 543 | { |
| 544 | const string key(el.name.c_str()); |
| 545 | string value(el.value); |
| 546 | |
| 547 | if (value.isEmpty()) |
| 548 | continue; |
| 549 | |
| 550 | if (key == "journal_source_directory") |
| 551 | { |
| 552 | config->sourceDirectory = value.c_str(); |
| 553 | PathUtils::ensureSeparator(config->sourceDirectory); |
| 554 | if (!checkAccess(&localStatus, config->sourceDirectory, key)) |
| 555 | { |
nothing calls this directly
no test coverage detected