From: Mark Wooding Date: Thu, 4 Jun 2020 19:22:02 +0000 (+0100) Subject: lib/configuration.c, lib/home.c: Introduce environment variables. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/8ab2aa9fd51a89e06d92a4f7c3792aaa4a08cc71?hp=8ab2aa9fd51a89e06d92a4f7c3792aaa4a08cc71 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. ---