So what is everyone using for their configuration files? xml, json.csv or?
It’s something I do with every installation using Unity. Some type of text file and also a debug or configuration UI with sliders that allow me to update application settings when its running and optionally save to and overwrite the existing configuration file.
Did a quick search here but surprisingly came up with nothing.
Are there any good example toes or tox files that have some sort of UI and the ability to load, parse and save config files?
As one possibility, wondering if using the Python ConfigParser module makes sense?
Json all the way. I personaly think it is the best human readable format of the listet ones.
Also python handles json really nicely already and can convert dicts to json and vice versa.
In combination with dependable properties in extensions it can be as simple as two lines of code to load and export settings.
2 Likes
Adding our solution to this old topic for the sake of sharing.
We created a little settings component (reusable tox available here) that loads settings from local files. Which settings file is loaded can be specified through an environment variable, as it was an important requirement for us to be able to run the same project with different configurations.
We opted for a csv-based settings files with a simple flat list of key/value pairs, as this provides an uncomplicated workflow with DAT tables and we didn’t feel there was a need for a nested hierarchy of settings values.
Very little python is used; basically only two lines of code to change the DAT Table’s file location if a location is specified in an env var, and some simple Get
and Set
API methods to access individual settings values (including auto-saving the settings file after Set
-ing new values) as well as some extension properties to get references to the CHOP and DAT containing the current settings values.