Remove bogus servers
This commit is contained in:
parent
008cf59c48
commit
aeaf57e196
@ -138,10 +138,13 @@ std::vector<std::string> config::get_template_local_paths()
|
|||||||
|
|
||||||
std::vector<std::string> config::get_local_server_definition_paths() {
|
std::vector<std::string> config::get_local_server_definition_paths() {
|
||||||
nlohmann::json server_definition_paths = mConfig["server_definition_paths"];
|
nlohmann::json server_definition_paths = mConfig["server_definition_paths"];
|
||||||
|
|
||||||
std::vector<std::string> paths;
|
std::vector<std::string> paths;
|
||||||
for (auto &path : server_definition_paths) {
|
for (auto &path : server_definition_paths) {
|
||||||
if (path.is_string() && !path.empty())
|
if (path.is_string() && !path.empty())
|
||||||
|
{
|
||||||
paths.push_back(path);
|
paths.push_back(path);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
std::cerr << "Warning: Invalid server definition path: " << path << std::endl;
|
std::cerr << "Warning: Invalid server definition path: " << path << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,9 @@ std::vector<ServerInfo> get_configured_servers() {
|
|||||||
if (std::filesystem::is_directory(entry)) {
|
if (std::filesystem::is_directory(entry)) {
|
||||||
std::string server_name = entry.path().filename().string();
|
std::string server_name = entry.path().filename().string();
|
||||||
|
|
||||||
|
if (server_name.empty() || server_name[0]=='.' || server_name[0]=='_')
|
||||||
|
continue;
|
||||||
|
|
||||||
server_env_manager env(server_name);
|
server_env_manager env(server_name);
|
||||||
if (!env.is_valid()) {
|
if (!env.is_valid()) {
|
||||||
std::cerr << "Error: Invalid server environment file: " << entry.path().string() << std::endl;
|
std::cerr << "Error: Invalid server environment file: " << entry.path().string() << std::endl;
|
||||||
|
@ -45,10 +45,10 @@ namespace localfile {
|
|||||||
|
|
||||||
namespace localpath {
|
namespace localpath {
|
||||||
std::string server(const std::string &server_name) {
|
std::string server(const std::string &server_name) {
|
||||||
if (server_name.empty()) return "";
|
|
||||||
for (std::filesystem::path dir : gConfig().get_local_server_definition_paths())
|
for (std::filesystem::path dir : gConfig().get_local_server_definition_paths())
|
||||||
if (fs::exists(dir / server_name))
|
if (fs::exists(dir / server_name))
|
||||||
return dir / server_name;
|
return dir / server_name;
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user