How do I set up variables of a C++ class using configuration files?

Long story, I need to change the default value of the variables of a C++ class without recompiling the code.
The approach I took was to use config file.

Following the documentation I wrote the following code in a file called SimonSaysGameMode.h in Root/Source/

UCLASS(BlueprintType, Config=Game)
class APPTREATMENTDEMO_API ASimonSaysGameMode : public AGameModeBase
{
	GENERATED_BODY()
	
public:

	ASimonSaysGameMode();

	UPROPERTY(Config)
		int RoundsToRaiseDifficulty;

	UPROPERTY(Config)
		int FaultPenaltyPoints;

        ...
};

I added the followind code in the file in Root/Config/DefaultEngine.ini

[/Script/SimonSaysGameMode.SimonSaysGameMode]
RoundsToRaiseDifficulty=10
FaultPenaltyPoints=1

How can I make the engine set the default values of this class based on the .ini file?

P.S: I made some code for explicit initialization, but, as far as I know, UE4 should be able to do this automatically.

ASimonSaysGameMode::ASimonSaysGameMode()
{
	PrimaryActorTick.bCanEverTick = true;

	GConfig->GetInt(
		TEXT("/Script/SimonSaysGameMode.SimonSaysGameMode"), 
		TEXT("RoundsToRaiseDifficulty"),
		RoundsToRaiseDifficulty,
		GEngineIni
	);

	GConfig->GetInt(
		TEXT("/Script/SimonSaysGameMode.SimonSaysGameMode"),
		TEXT("FaultPenaltyPoints"),
		FaultPenaltyPoints,
		GEngineIni
	);

}

In the ini file the part after /Script/ and before .SimonSaysGameMode should be your game module name:

 [/Script/MyGameModule.SimonSaysGameMode]
 RoundsToRaiseDifficulty=10
 FaultPenaltyPoints=1

How can I know the name of MyGameModule?

I mean, I undertand that is the name of the file in wich the class is defined. Is perhaps the name of the UE4 proyect?

The module name is usually the name of the folder where your source files are located. Module folders are usually located under /YourProject/Source/ directory.

Judging by the class definition you provided I can assume that your module is called AppTreatmentDemo because your class is prefixed as APPTREATMENTDEMO_API. In this case your ini file should be like this:

[/Script/AppTreatmentDemo.SimonSaysGameMode]
RoundsToRaiseDifficulty=10
FaultPenaltyPoints=1

PS. This name matches your project name by default so you are generally correct about it being your project’s name.