The configuration method for the Gunicorn server ( http://docs.gunicorn.org/en/stable/configure.html#configurat... ) would be a great example to follow. Configuration files are just Python modules. You can specify the number of workers and set log file locations with the following: from multiprocessing import cpu_count def max_workers(): return cpu_count() * 2 + 1 workers = max_workers() errorlog = "/var/www/lcfs/log…
In Defense of YAML
161–170 of 173 posts
Re: In Defense of YAML
#162Recently been working on a rails app and been forced to use nano for editing one a remote server and it's now that I really see the niceness of YAML. I always like YAML with ruby but I think a lot of the great features are subtle and hard to appreciate. Inheritance! What a great idea for a configuration language. Greatly missed in JSON.
Re: In Defense of YAML
#163While there are no other format with clear advantage over YAML, I wonder why nobody use javascript with modules as programmable configuration. Can be broken to file parts, support comment, variable, functions or scripts. And with additional extension can import packages. Though the downside may be JSON format that's noticably bigger than yaml.
Re: In Defense of YAML
#164Re: In Defense of YAML
#165Earlier quoted context omitted.
> Whatever is the final evaluator gets to define what is required. Which is completely useless, because it means everyone will do it differently. > Beyond that, give your users the power to do it their way. Or they will find a way to get it themselves. Users put value on having a standard set of scaffolding. That's why these standardised config formats have succeeded.
Have you seen the plethora of templating engines used to generate the yaml configs out there? I am surrounded by folks that think Jinja to create yaml is a normal idea. Good, even. Then there is the slow creep of Turing into config for the sake of dynamic config. Starts as a simple condition flag. Then add if/then logic. It is an amusing tread. So, yes. You can get a lot of variety in how configs look. But at the end…
Re: In Defense of YAML
#166Earlier quoted context omitted.
Have you seen the plethora of templating engines used to generate the yaml configs out there? I am surrounded by folks that think Jinja to create yaml is a normal idea. Good, even. Then there is the slow creep of Turing into config for the sake of dynamic config. Starts as a simple condition flag. Then add if/then logic. It is an amusing tread. So, yes. You can get a lot of variety in how configs look. But at the end…
Are those options agreed on and used consistently though? Other people's emacs configs are even more notoriously unreadable than Jinja-templated yaml, IME.
Reading people's CloudFormation and related templates? Especially if they are done using jinja or some other yaml generation trick? Near impossible.
To directly answer your question, though. No, it does not appear that anyone agrees on how to generate config for things. Which is why every team I join seems to have invented a new way for doing it, all in the name of "maintainability." I often get dirty looks for suggesting that people not build automation on top of the config before they have proven it is truly needed with experience. (That is, if this is your first config to create, do it by hand for the reviewability, if for no other reason.)
Re: In Defense of YAML
#167Re: In Defense of YAML
#168Why we even have something like yaml? We already got JSON, same key value format, but more reliable. I remember my first docker experience was ruined because of yaml and wrong formatting.
Re: In Defense of YAML
#169Re: In Defense of YAML
#170Earlier quoted context omitted.
Is something typed and better structured (e.g. protobufs) an option?
You can edit YAML with any text editor... how do you edit protobuf files?