mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 12:37:08 +11:00
made user & config save configurable
This commit is contained in:
parent
9a3a54c4ca
commit
e681b4109d
3 changed files with 6 additions and 4 deletions
|
|
@ -3,4 +3,6 @@
|
|||
// Setting both values to 0 does not compile logging
|
||||
constexpr unsigned max_log_size = 100;
|
||||
constexpr unsigned pre_log_size = 10;
|
||||
constexpr unsigned max_name_size = 50;
|
||||
constexpr unsigned max_name_size = 50;
|
||||
constexpr const char *users_location = "../users.json";
|
||||
constexpr const char *config_location = "../config.json";
|
||||
2
main.cpp
2
main.cpp
|
|
@ -73,7 +73,7 @@ int main(int argc, char **argv)
|
|||
[](const drogon::HttpRequestPtr &req, const drogon::HttpResponsePtr &resp) {
|
||||
resp->addHeader("Access-Control-Allow-Origin", "*");
|
||||
});
|
||||
app().loadConfigFile("../config.json").registerController(API).setThreadNum(std::stoul(argv[3])).run();
|
||||
app().loadConfigFile(config_location).registerController(API).setThreadNum(std::stoul(argv[3])).run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ void Bank::Save()
|
|||
}
|
||||
else
|
||||
{
|
||||
std::ofstream user_save("../users.json");
|
||||
std::ofstream user_save(users_location);
|
||||
Json::StreamWriterBuilder builder;
|
||||
const std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter());
|
||||
writer->write(temp, &user_save);
|
||||
|
|
@ -252,7 +252,7 @@ void Bank::Load()
|
|||
Json::CharReaderBuilder builder;
|
||||
|
||||
Json::Value temp;
|
||||
std::ifstream user_save("../users.json");
|
||||
std::ifstream user_save(users_location);
|
||||
builder["collectComments"] = true;
|
||||
JSONCPP_STRING errs;
|
||||
if (!parseFromStream(builder, user_save, &temp, &errs))
|
||||
|
|
|
|||
Loading…
Reference in a new issue