[IDEA] - Configuration File as JSON
Change the configuration.ini to configuration.json
With this, we can do jerarquization, and add a json-schema to validate the syntax of the configuration.
Also, access to the configuration should be done with a Singleton.
Another enchancement can be make a callback onChange. So changes in the configuration will not require restart of CKAN
I'm suggesting we close this.
- It's an .ini file, it already validates the syntax.
- Access to the configuration is already a singleton
- Modifying the configuration already reloads CKAN if you have the reloader on.
- There is no benefit to this change, but a bunch of headaches.
- I dont see anywhere the schema for the .ini (Also i think it dont exist the concept, or atleast its not so powerful - ini cant handle hierarchy)
- I dont see a class that handles and saves the information of the configuration in a simply way (Can you show me where it is?)
- I dont know that CKAN have this feature, how can i activate it.
- Python is always a bunch of headaches (Interpreted, dynamic types, no braces, etc.. )
Maybe we can step back for a moment. What's the actual problem you've got that makes you want to change the ini file to another format?
@wardi It's not a problem, its only a idea of how to make a configuration file more understandable (Hirarchy, Schema, etc... ) JSON or XML files are better for configuration files.
So, i only send this idea to make the changes when CKAN breaks backward compatibility (Cause this idea will also break backward compatibility)
That's interesting!
I'm on the other side of the "more understandable" argument. I really like the ini format because it's so limited. I also hate editing JSON in a text editor because it's so easy to forget a brace or comma, breaking the whole file.
I also expect lots of problems with trying to validate the configuration when it includes values for multiple plugins (many that only one person will use.) Some of those plugins modify the configuration when they're being loaded, too.
@wardi well the feature of a schema is to make sure that an int is an int, and a URL has the expected format of an URL (Can be checked by CKAN and also some text editor can do it if you are editing a ckan-config.json and the schema is called ckan-config.schema.json) (For example the solr_url = http:/127.0.0.1:8983/solr will not be accepted cause i left a "/" in the url)
For the plugins bug, the schema allows add new configurations, only check that required parameters are correct, and the format of the optionals are correct, you can also add new parameters in the json that will not be validated
Python is always a bunch of headaches (Interpreted, dynamic types, no braces, etc.. )
It's fine if you don't share the philosophy of python and ini not being strict about types and leaving errors to run-time. It's pretty embedded in this project though. I don't think we're going to solve this in a github issue for one little under-resourced project.