ideas icon indicating copy to clipboard operation
ideas copied to clipboard

[IDEA] - Configuration File as JSON

Open deinok opened this issue 9 years ago • 7 comments

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

deinok avatar Nov 15 '16 23:11 deinok

I'm suggesting we close this.

  1. It's an .ini file, it already validates the syntax.
  2. Access to the configuration is already a singleton
  3. Modifying the configuration already reloads CKAN if you have the reloader on.
  4. There is no benefit to this change, but a bunch of headaches.

TkTech avatar Dec 13 '16 17:12 TkTech

  1. 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)
  2. 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?)
  3. I dont know that CKAN have this feature, how can i activate it.
  4. Python is always a bunch of headaches (Interpreted, dynamic types, no braces, etc.. )

deinok avatar Dec 13 '16 18:12 deinok

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 avatar Dec 13 '16 18:12 wardi

@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)

deinok avatar Dec 13 '16 18:12 deinok

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 avatar Dec 13 '16 18:12 wardi

@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

deinok avatar Dec 13 '16 19:12 deinok

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.

davidread avatar Dec 14 '16 18:12 davidread