Fixed configuration initialization of filer

This commit is contained in:
2025-01-01 14:13:31 -06:00
parent 73d58b9f52
commit 54693d03cd
3 changed files with 9 additions and 2 deletions

View File

@@ -35,10 +35,15 @@ public:
logger->print(LOGLEVEL_ERROR, "No filer factory available");
return;
}
filer = default_filer_factory();
this->setupFiler();
submit(230, conf_format(server_name, (std::map<std::string, std::string>){{std::string(APPNAME_VAR),std::string(APPNAME)},{std::string(VERSION_VAR),std::string(VERSION)}}));
}
void setupFiler() {
filer = default_filer_factory();
filer->initialize(config->get(default_filer_name)->get());
}
int receive(std::string cmd, std::string argstr) {
if (control_sock <= 0) return 1;
@@ -91,7 +96,7 @@ public:
} else if (cmd == "REIN") {
if (state == FTP_STATE_ONDATA) data_close();
auth_data = new ClientAuthDetails{};
filer = default_filer_factory();
this->setupFiler();
// Reset features
for (const auto &x : features)
features[x.first] = "OFF";

View File

@@ -209,6 +209,7 @@ void initializePlugins() {
// Initialize filer
std::string filer_type = config->getValue("engines", "filer", "local");
default_filer_name = filer_type;
default_filer_factory = filer_manager.getFactory(filer_type);
if (!default_filer_factory) {

View File

@@ -22,6 +22,7 @@ std::string motd;
ConfigFile* config;
Auth* auth;
Logger* logger;
static std::string default_filer_name;
static typename PluginTraits<Filer>::CreateFunc default_filer_factory = nullptr;
bool runServer;
bool runCompression;