4 ms·
Do me a favor, please do not write your configuration files in Clojure as well. As a non-Clojure developer, having to fight with Clojure configuration files fo
by falcolas 12y ago
Do me a favor, please do not write your configuration files in Clojure as well.
As a non-Clojure developer, having to fight with Clojure configuration files for Riemann was a real pain point, and ended up deciding us against using Riemann for anything as a result (trying to convince a team of sysadmins that they would have to learn Clojure for a single piece of their monitoring infrastructure... didn't work).
IMHO, you're welcome to enjoy your language to the fullest extent possible, I would just ask that you don't force others to use it as well.
EDIT: Since it was asked twice in about 30 seconds, here's why having Clojure as a config option can be bad; it encourages things like this:
https://github.com/guardian/riemann-config/blob/master/main.clj https://github.com/guardian/riemann-config/blob/master/main....
Please note that this is considered to be the gold standard by Riemann; it's directly referenced in their documentation.
As for my preferred config file format? ini, yaml, json, in that order. They're simple, there are lots of tools out there to read and write them, and friendly to humans.
- whichdan 12y agoWhat format would you prefer instead? YAML?
- themckman 12y agoThe problem with using something like YAML to configure (if you even want to call it that) Riemann is that to do anything useful, you're going to end up inventing some convoluted "language", anyways. I'd much rather spend some time learning Clojure which I can take elsewhere than a custom YAML DSL.
- falcolas 12y agoYeah. After digging into it, I figured out that Riemann is more of a framework for building a monitoring tool than a monitoring tool itself. It provided powerful abstractions handling streams of monitoring data, but it was too unwieldy to be considered unless you started with Riemann and built out your environment on top of it.
- nickik 12y agoWhat would you want? Json and Clojure is pretty much the same for using as config. XML sucks much more, hand rolling something is not a good idea. What should it be?
- technomancy 12y agoSort of, except JSON is a fair bit worse since you can't have comments to explain why things are the way they are.
- venantius 12y agoI think it really depends on the context and tools. I've come to believe, for instance, that trying to do logging configuration any way other than just using a standard log4j.properties file is a path to madness; at the same time, Lein profiles are a potent and idiomatic way to do certain types of environment configuration. The biggest argument in favor of more friendly config files for me is that they're easier to toss in a jar, though. Nobody wants to fight against configuration in their production environment.
- davexunit 12y ago>Do me a favor, please do not write your configuration files in Clojure as well. Code is data and data is code. For Lisp programs, configuration is just another Lisp program. I don't want my Lisp programs crippled by a "dumb" config file.
- falcolas 12y agoIf your configuration file is a Lisp file, then it's not a configuration file. It's a distributed portion of your program which is wide open to being destroyed by a sysadmin. "What do you mean I took down the site by adding a TLS parameter to the config file? How could a config file overwrite a function symbol in your code?!" What a config file should be is the simplest, most easy to read and fill out configuration file you can possibly think of. It should be tolerant of simple formatting mistakes and be targeted at someone who is not as smart as you are. It should also never contain executable code, because config files are rarely as well protected on a system as executable code is, and this could lead to some really nasty vulnerabilities if it's exploited.
- nostrademons 12y agoThis is the case with all config files, though, regardless how simple. The incident where Google accidentally blacklisted the entire Internet [1] was because of a one-character typo in a config file. The lesson you should learn from this is not to never include powerful statements or interpreted strings in config files, it's that you should test your configs as if they were code, because mistakes in them are just as dire. Even if you limit yourself to key/values in a .properties file, you can still bring down the site if you typo a filesystem path or database name. [1] http://www.theguardian.com/technology/2009/jan/31/google-blacklist-internet http://www.theguardian.com/technology/2009/jan/31/google-bla...
- puredanger 12y agoThe most common way to do this in Clojure is to use an EDN file. EDN is similar to Clojure syntax but the EDN reader (intentionally) has no arbitrary runtime execution functionality - it just reads a data structure and returns it.
- jgalt212 12y agoAlthough, slightly outside of this scope, I cannot say enough good things about YAML. For example, we use it for parameterized test cases that must be passed in code written in various languages. i.e. Python server function does the same thing as client JavaScript function. As for not using JSON, I prefer YAML b/c often times we like to put comments in our test cases. This is really just no doable in JSON (outside of some ugly hacks. e.g. repeated keys (last one wins)).