-
Notifications
You must be signed in to change notification settings - Fork 115
Parsing of JSON settings could be simplified #55
Comments
@atapin, Thanks for the comment. My main point is that So, the main question is: is there a reason to keep |
Why don't you keep settings in typesafe's HOCON? |
In the near future, the configuration of the Scorex project will go to HOCON |
@Tolsi , I added a new field to NetworkSettings and Ficus is not managing to automatically obtain the value for that field from "settings.conf". My changes and the stack trace can be seen here: 60713a8 . If you have some time, could you have a look and tell me what else I need to do? Also, I noticed that the example "settings.conf" files don't have values for all the fields in the |
Ok. After debugging the config parsing process, I got the answer to the question above. The parser falls back on “src/main/resources/reference.conf”. So, values that are not specified in “examples/src/test/resources/settings.conf” are read from “src/main/resources/reference.conf”. I still don't know the answer to the first question (i.e. why Ficus is failing to convert the config to a NetworkSettings object, despite the changes I made in 60713a8), though... Does anyone know? (I still haven't debugged this part of the process yet...) |
In this commit I show that, if I add I still don't know what is causing this problem. For a short while I thought it could be Scala's limits on the number of arguments for case classes, or some other similar limit. I don't think this is the problem now, but it could become a problem in the future, if Scorex's configuration case classes grow too large. |
Ok. Problem solved. I documented this strange behaviour here: https://stackoverflow.com/questions/47068594/why-is-ficus-throwing-an-exception-when-i-try-to-add-a-new-field-in-my-case-clas/47071839#47071839 . And I notified the Ficus developers of this potential bug here: iheartradio/ficus#55 . |
I would suggest using
play.api.libs.json.Json
and makingSettings
a case class. Similar to what is done in Agora for parsing parameters (see https://gitlab.com/aossie/Agora/blob/master/src/main/scala/agora/parser/ParameterParser.scala and lines 39--65 in https://gitlab.com/aossie/Agora/blob/master/src/main/scala/agora/model/Parameters.scala).The text was updated successfully, but these errors were encountered: