Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 9659be9

Browse files
authored
Merge pull request #350 from janhq/135-bug-unexpected-creation-of-uploads-folder-in-current-directory-when-running-nitroexe
feat: add uploads folder path
2 parents bcdcbd2 + 2204ad9 commit 9659be9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

main.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ int main(int argc, char *argv[]) {
2121
int thread_num = 1;
2222
std::string host = "127.0.0.1";
2323
int port = 3928;
24+
std::string uploads_folder_path;
2425

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

41+
// Uploads folder path
42+
if (argc > 4) {
43+
uploads_folder_path = argv[4];
44+
}
45+
4046
int logical_cores = std::thread::hardware_concurrency();
4147
int drogon_thread_num = std::max(thread_num, logical_cores);
4248
nitro_utils::nitro_logo();
@@ -49,6 +55,10 @@ int main(int argc, char *argv[]) {
4955
LOG_INFO << "Please load your model";
5056
drogon::app().addListener(host, port);
5157
drogon::app().setThreadNum(drogon_thread_num);
58+
if (!uploads_folder_path.empty()) {
59+
LOG_INFO << "Drogon uploads folder is at: " << uploads_folder_path;
60+
drogon::app().setUploadPath(uploads_folder_path);
61+
}
5262
LOG_INFO << "Number of thread is:" << drogon::app().getThreadNum();
5363

5464
drogon::app().run();

0 commit comments

Comments
 (0)