Live data from Hacker News

Levels of configuration languages

beza1e1.tuxen.de

11–20 of 69 posts

Re: Levels of configuration languages

#11
post #7

About 20 or so years ago, I have come across a configuration pattern that could be arguably called "Level 0". It was configuration by file existence. The file itself would be typically empty. So no parsing, syntax, or schema involved. For example, if the file /opt/foo/foo.txt exists, the software does one thing but if it is missing the software does another thing. So effectively, the existence of the file serves as a…

[deleted]

Re: Levels of configuration languages

#12

> Don't waste time on discussions within a level. For example, JSON and YAML both have their problems and pitfalls but both are probably good enough. Disagree. YAML is considerably easier to work with than JSON, and it’s worth dying on that hill.

I love that there is one comment saying JSON is better, and then yours saying YAML is better.

Re: Levels of configuration languages

#13
For my personal projects I am drifting towards the simple side. More and more I try to stick with a simple single level key value configuration.

But if you do require a complex configuration, I think it is beneficial to both yourself and your users to invest in a openbsd style parse.y like solution rather than just shovel the usual json or yaml slop.

https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/usr...

By which I mean it does not have to be yacc, but taking the time to think about the language of your configurations improves the ui dramaticly.

Re: Levels of configuration languages

#15

> Don't waste time on discussions within a level. For example, JSON and YAML both have their problems and pitfalls but both are probably good enough. Disagree. YAML is considerably easier to work with than JSON, and it’s worth dying on that hill.

I love that there is one comment saying JSON is better, and then yours saying YAML is better.

To be fair, both say "don't waste time" on it.

Re: Levels of configuration languages

#16
post #7

About 20 or so years ago, I have come across a configuration pattern that could be arguably called "Level 0". It was configuration by file existence. The file itself would be typically empty. So no parsing, syntax, or schema involved. For example, if the file /opt/foo/foo.txt exists, the software does one thing but if it is missing the software does another thing. So effectively, the existence of the file serves as a…

I use this approach for testing conditional logic in shell scripts sometimes.

Re: Levels of configuration languages

#17

> Don't waste time on discussions within a level. For example, JSON and YAML both have their problems and pitfalls but both are probably good enough. Disagree. YAML is considerably easier to work with than JSON, and it’s worth dying on that hill.

anchors/aliases/overrides are one of my favourite yaml features. i've done so much configuration de-duplication with them, it's unreal.

Re: Levels of configuration languages

#19
post #7

About 20 or so years ago, I have come across a configuration pattern that could be arguably called "Level 0". It was configuration by file existence. The file itself would be typically empty. So no parsing, syntax, or schema involved. For example, if the file /opt/foo/foo.txt exists, the software does one thing but if it is missing the software does another thing. So effectively, the existence of the file serves as a…

A number of traditional unix utilities change their behavior based on what their name is. /bin/test and /bin/[ come to mind. but I just checked and a quick survey of openbsd finds.

    eject mt
    [ test
    chgrp chmod
    cksum md5 sha1 sha256 sha512
    cpio pax tar
    ksh rksh sh
taken to it's logical extreme you end up with somthing like crunchgen https://man.openbsd.org/crunchgen which merges many independent programs into one and select which one to run based on the name.

And I am guilty of abusing symbolic links as a simple single value key value store. It turns out the link does not need to point to anything and using readlink(1) was easier than parsing a file.

Re: Levels of configuration languages

#20
post #4

I'm not convinced by reducing this to a single dimension. There are differences in both 'what can be expressed' and 'what validation can be done' which are somewhat independent of each other

Hm, you got me thinking about reversible computing and how it could be applied to configuration.

Debugging a configuration becomes tedious once computation is involved. You think some value should be "foo" but it is "bar". Why is it "bar"? If someone wrote it there, the fix is simply to change. If "bar" is the result of some computation, you have to understand the algorithm and its inputs, which is significantly harder.

Given a "reversible" programming language that might be easier. Such languages are weird though and I don't know much about them. For example: https://en.wikipedia.org/wiki/Janus_(time-reversible_computi...

Post reply on HN