iFun Engine provides RESTful API to dynamically change some of the server configuration.
Mutable configuration includes iFun Engine flags as shown below and your own flags.
(Since iFun Engine relies on Google Gflags for its command-line flag processing, you can easily add your own flags. Please refer to the Google Gflags documents for details.)

minloglevel: This changes the minimum log level.

v: This changes the verbosity.

alsologtostderr: This turns on/off log messages to the standard error in addition to the log file.

session_message_logging_level: This changes log levels for session messages between the client and the server. 0 for no session message logging, 1 for message type and length only, and 2 for entire message dump. Please refer to Networking parameters for details.

rpc_message_logging_level: This changes log levels for RPC messages between servers. 0 for no message logging, 1 for message type and length only, and 2 for entire message dump. Please see Distribution parameters for details.

event_threads_size: This changes the number of main threads. Please refer to Event parameters.

client_current_version: This changes the required client version to connect the server. This can prevent clients with invalid versions from connecting to the server. Please refer to Client version control.

Important

Please be aware that the change is tentative and does not mean overwriting the MANIFEST.json file.

HTTP/1.1200OKContent-Type:application/json{"enable_gold_event":{"result":"enable_gold_event set to true\n"}}

You might write a code snippet that copies the Google flag value to a variable, rather than directly reading the flag. But, please keep it mind that this approach will not work, since changes to the flag do not imply changes to the variable. For example, say we have a class named EventManager which keeps track of in-game campaigns and the class has a method named EventManager::IsGoldEventEnabled that returns a internal copy of the Google flag. Code would look like this:

// server.ccDEFINE_bool(enable_gold_event,false,"gold event flag");// Assume below method is invoked when the server starts.voidStart(){// the enable_gold_event flag is set to false, by default.// We are passing the flag value when initialization our EventManager class.EventManager::Initialize(FLAGS_enable_gold_event);}// event_manager.ccboolthe_is_gold_event_enabled=false;voidEventManager::Initialize(boolis_gold_event_enabled){// The initialization method makes a local copy of the flag.the_is_gold_event_enabled=is_gold_event_enabled;}boolEventManager::IsGoldEventEnabled(){// This getter method simply returns the local copy.returnthe_is_gold_event_enabled;}// user.ccvoidOnLogin(){Ptr<User>user=User::Fetch(...);// We will reward the user some gold if the gold campaign is in progress.// But this code has a flaw, since EventManager::IsGoldEventEnabled() cached the flag value.if(EventManager::IsGoldEventEnabled()){user->SetGold(user->GetGold()+100);}}

As we outlined above, EventManager::Initialize() returns a local copy of the enable_gold_event Google flag.
So, changes to the flag are not relevant to the local variable. And this is obviously not what we want. So, please do not forget to directly read the flag if the flag is set to mutable via the REST API. Correct code should look like this:

// server.ccDEFINE_bool(enable_gold_event,false,"gold event flag");// Assume below method is invoked when the server starts.voidStart(){// Please note that we are not passing the flag value anymore.EventManager::Initialize();}// event_manager.cc// To read the flag, we need to use Google flags DECLARE_*(...) macros.// In this example, we will use DECLARE_bool(...) as the flag is boolean.DECLARE_bool(enable_gold_event);voidEventManager::Initialize(){...}boolEventManager::IsGoldEventEnabled(){// This function now reads the flag directly, which is correct.returnFLAGS_enable_gold_event;}// user.ccvoidOnLogin(){Ptr<User>user=User::Fetch(...);// Now, we can turn on/off the event via the REST API.if(EventManager::IsGoldEventEnabled()){user->SetGold(user->GetGold()+100);}}