boxidau / rax-autoscaler

Apache License 2.0
5 stars 2 forks source link

Yaml configuration file #38

Open siso opened 9 years ago

siso commented 9 years ago

What about using Yaml for configuration file, as it would be more human-readable?

boxidau commented 9 years ago

I have a personal preference for JSON, harder to corrupt with editors too

Teddy-Schmitz commented 9 years ago

While I also prefer JSON, it can get hard to read. Especially if we are adding more and more config items and features.

siso commented 9 years ago

OK, let's have JSON as default configuration file.

What about: if YAML was found, then it would be converted to JSON? It'd be just adding a preliminary check, before parsing config file.

https://docs.python.org/2/library/json.html#module-json says:

Note

JSON is a subset of YAML 1.2. The JSON produced by this module’s default settings (in particular, the default separators value) is also a subset of YAML 1.0 and 1.1. This module can thus also be used as a YAML serializer.

It seems pretty straightforward to convert JSON-YAML back and forth:

http://www.commandlinefu.com/commands/view/12218/convert-yaml-to-json

python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < file.yaml > file.json
siso commented 9 years ago

@boxidau @sura8257 @Teddy-Schmitz @jon-walton any thoughts? Shall we implement it, or close as "wontfix"?

jon-walton commented 9 years ago

I have to start with saying, I'm not a fan of YAML

YAML might be more human readable, but that's at the expense of being less friendly to edit (it's extremely picky with indentation as an example). If we switch to YAML for the configuration file, I can see users having more issues with invalid yaml due to indentation, etc

siso commented 9 years ago

Let's kill two birds with one stone. JSON is the preferred format, and we can support YAML as follow: