chiark / gitweb /
lib/configuration.c, lib/home.c: Introduce environment variables.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 4 Jun 2020 19:22:02 +0000 (20:22 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 15 Jun 2020 12:02:44 +0000 (13:02 +0100)
commit8ab2aa9fd51a89e06d92a4f7c3792aaa4a08cc71
tree89ae45dd8863449ad18b49b36b8a372307d31dee
parente1e3ef08ef3419f4aabcfb3f45ab49a78000cdb7
lib/configuration.c, lib/home.c: Introduce environment variables.

The places where DisOrder looks for configuration can now be overridden
using environment variables.

  * `$DISORDER_CONFIG' is the master configuration file -- defaults to
    `PKGCONFDIR/config', where `PKGCONFDIR' is set at compile
    time (e.g., `/etc/disorder'.

  * `$DISORDER_PRIVCONFIG' is the private configuration file -- defaults
    to `$DISORDER_CONFIG.private'.

  * `$DISORDER_HOME' is the user's `profile directory' for DisOrder
    things -- defaults to `$HOME/.disorder' on Unix, or
    `%APPDATA%/DisOrder' (i.e., in the roaming profile directory) on
    Windows.

  * `$DISORDER_USERCONFIG' is the user's configuration file -- defaults
    to `$DISORDER_HOME/passwd'.

  * `$DISORDER_USERCONFIG_SYS' is the per-user system configuration file
    -- defaults to `$DISORDER_CONFIG.USERNAME'.

The primary motivation for all of this is to make it easier to run
clients -- particularly Disobedience and its `disorder-playrtp'
inferiors -- against multiple servers simultaneously.  Setting
configuration on the command line works rather badly for clients, since
that overrides the /system/ configuration, which the user can't edit
anyway -- the client programs still read `$HOME/passwd' unconditionally.
This is clearly a bug, but changing the behaviour now is a bad idea;
besides, changing `-c' (or introducing a new option) to override the
`passwd' file, doesn't actually help much unless Disobedience in turn
passes the necessary option on to `disorder-playrtp'.  Environment
variables solve all of these problems much more simply.
doc/disobedience.1.in
doc/disorder-dump.8.in
doc/disorder-playrtp.1.in
doc/disorder.1.in
doc/disorder_config.5.in
doc/disorderd.8.in
lib/configuration.c
lib/home.c