Skip to content

Commit

Permalink
feat: add uploads folder path
Browse files Browse the repository at this point in the history
  • Loading branch information
tikikun committed Jan 16, 2024
1 parent bcdcbd2 commit 2204ad9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ int main(int argc, char *argv[]) {
int thread_num = 1;
std::string host = "127.0.0.1";
int port = 3928;
std::string uploads_folder_path;

// Number of nitro threads
if (argc > 1) {
Expand All @@ -37,6 +38,11 @@ int main(int argc, char *argv[]) {
port = std::atoi(argv[3]); // Convert string argument to int
}

// Uploads folder path
if (argc > 4) {
uploads_folder_path = argv[4];
}

int logical_cores = std::thread::hardware_concurrency();
int drogon_thread_num = std::max(thread_num, logical_cores);
nitro_utils::nitro_logo();
Expand All @@ -49,6 +55,10 @@ int main(int argc, char *argv[]) {
LOG_INFO << "Please load your model";
drogon::app().addListener(host, port);
drogon::app().setThreadNum(drogon_thread_num);
if (!uploads_folder_path.empty()) {
LOG_INFO << "Drogon uploads folder is at: " << uploads_folder_path;
drogon::app().setUploadPath(uploads_folder_path);
}
LOG_INFO << "Number of thread is:" << drogon::app().getThreadNum();

drogon::app().run();
Expand Down

0 comments on commit 2204ad9

Please sign in to comment.