[Discuss] Application config files

Derek Martin invalid at pizzashack.org
Tue Jul 23 13:51:11 EDT 2019


On Mon, Jul 22, 2019 at 07:28:08PM -0400, Rich Pieri wrote:
> On Mon, 22 Jul 2019 15:33:20 -0500
> Derek Martin <invalid at pizzashack.org> wrote:
> 
> > But an .ini file (what we were discussing) IS easily stored in simple
> > key/value pairs, because that's exactly what it is.  We were also
> > talking about Python, and it's easy enough to GUARANTEE that such a
> > simple structure  is printed readibly:
> 
> But we're not discussing the printing of the configuration data.
> We're discussing the storing of the configuration data in configuration
> files in ways that are both humanly editable *and* computer readable.
> JSON does not necessarily meet these two requirements.

Effectively, printing = storing.  In Unix, I/O is I/O.  And given the
stated constraints, it certainly will meet those two requirements. As
long as it (or some suitable example config that can be copied) is
already formatted readibly, no human who's likely to be mucking about
with configuration data should reasonably have any difficulty editing
it.  And if you're concerned about some random luser intentionally
making it difficult, which I don't imagine is a concern here, you can
just have the app rewrite the config file after it's read, ensuring
that it's well formatted.

There are other options, and JSON/Python may not be as ideal as some
other arbitrary solution based on arbitrary criteria, but it will work
just fine for this application.

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



More information about the Discuss mailing list