diff --git a/src/client.cpp b/src/client.cpp index c01c73b..f3a9d83 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -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(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"; diff --git a/src/main.cpp b/src/main.cpp index a96a6d2..e57401c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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) { diff --git a/src/main.h b/src/main.h index f7d00f3..7be20d0 100644 --- a/src/main.h +++ b/src/main.h @@ -22,6 +22,7 @@ std::string motd; ConfigFile* config; Auth* auth; Logger* logger; +static std::string default_filer_name; static typename PluginTraits::CreateFunc default_filer_factory = nullptr; bool runServer; bool runCompression;