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.
.B \-\-config \fIPATH\fR, \fB\-c \fIPATH
Set the configuration file.
The default is
.B \-\-config \fIPATH\fR, \fB\-c \fIPATH
Set the configuration file.
The default is
+given by the
+.B DISORDER_CONFIG
+environment variable, defaulting to
.IR pkgconfdir/config .
.TP
.B \-\-debug\fR, \fB\-d
.IR pkgconfdir/config .
.TP
.B \-\-debug\fR, \fB\-d
.B \-\-config \fIPATH\fR, \fB\-c \fIPATH
Set the configuration file.
The default is
.B \-\-config \fIPATH\fR, \fB\-c \fIPATH
Set the configuration file.
The default is
+.B DISORDER_CONFIG
+environment variable, defaulting to
.IR /etc/disorder/config .
.TP
.B \-\-no\-setuid
.IR /etc/disorder/config .
.TP
.B \-\-no\-setuid
.B \-\-config \fIPATH\fR, \fB\-C \fIPATH
Set the configuration file.
The default is
.B \-\-config \fIPATH\fR, \fB\-C \fIPATH
Set the configuration file.
The default is
+given by the
+.B DISORDER_CONFIG
+environment variable, defaulting to
.IR pkgconfdir/config .
.TP
.B \-\-socket \fIPATH\fR, \fB\-s \fIPATH
.IR pkgconfdir/config .
.TP
.B \-\-socket \fIPATH\fR, \fB\-s \fIPATH
.B \-\-config \fIPATH\fR, \fB\-c \fIPATH
Set the configuration file.
The default is
.B \-\-config \fIPATH\fR, \fB\-c \fIPATH
Set the configuration file.
The default is
+given by the
+.B DISORDER_CONFIG
+environment variable, defaulting to
.IR pkgconfdir/config .
.TP
.B \-\-debug\fR, \fB\-d
.IR pkgconfdir/config .
.TP
.B \-\-debug\fR, \fB\-d
be different locally.
.SH ENVIRONMENT
.TP
be different locally.
.SH ENVIRONMENT
.TP
+.B DISORDER_CONFIG
+Main configuration file to use instead of
+.IR pkgconfdir/config .
+Overridden by the
+.B \-c
+.RB ( \-\-config )
+command-line option.
+.TP
+.B DISORDER_HOME
+Per-user configuration and state directory to use instead of
+.BR $HOME/.disorder .
+.TP
+.B DISORDER_PRIVCONFIG
+Private configuration file to use instead of
+.IR pkgconfdir/config.private .
+.TP
+.B DISORDER_USERCONFIG
+Per-user configuration file to use instead of
+.BR $DISORDER_HOME/passwd .
+.TP
+.B DISORDER_USERCONFIG_SYS
+System-provided per-user configuration file to use instead of
+.BR $DISORDER_HOME/passwd .
+.TP
.B HOME
The user's home directory.
.TP
.B HOME
The user's home directory.
.TP
Configuration files are read in the following order:
.TP
.I pkgconfdir/config
Configuration files are read in the following order:
.TP
.I pkgconfdir/config
+Or
+.BR $DISORDER_CONFIG ,
+if that's set; overridden by
+.B \-c
+.RB ( \-\-config )
+command line option, except in
+.BR disrder-playrtp (1),
+which uses
+.BR \-C .
.TP
.I pkgconfdir/config.private
.TP
.I pkgconfdir/config.private
+Or
+.BR $DISORDER_PRIVCONFIG ,
+if that's set, else
+.BR $DISORDER_CONFIG.private .
Should be readable only by the jukebox group.
Not really useful any more and will be abolished in future.
.TP
.I ~\fRUSERNAME\fI/.disorder/passwd
Should be readable only by the jukebox group.
Not really useful any more and will be abolished in future.
.TP
.I ~\fRUSERNAME\fI/.disorder/passwd
+Or
+.BR $DISORDER_USERCONFIG ,
+if that's set; else
+.BR $DISORDER_HOME/passwd .
Per-user client configuration.
Optional but if it exists must be readable only by the relevant user.
Would normally contain a \fBpassword\fR directive.
.TP
.I pkgconfdir/config.\fRUSERNAME
Per-user client configuration.
Optional but if it exists must be readable only by the relevant user.
Would normally contain a \fBpassword\fR directive.
.TP
.I pkgconfdir/config.\fRUSERNAME
+(Or
+.BR $DISORDER_USERCONFIG_SYS ,
+if that's set; else
+.BR $DISORDER_CONFIG.\fIUSERNAME .)
Per-user system-controlled client configuration.
Optional but if it exists must be readable only by the relevant user.
Would normally contain a \fBpassword\fR directive.
Per-user system-controlled client configuration.
Optional but if it exists must be readable only by the relevant user.
Would normally contain a \fBpassword\fR directive.
.B \-\-config \fIPATH\fR, \fB\-c \fIPATH
Set the configuration file.
The default is
.B \-\-config \fIPATH\fR, \fB\-c \fIPATH
Set the configuration file.
The default is
+given by the
+.B DISORDER_CONFIG
+environment variable, defaulting to
.IR pkgconfdir/config .
See
.BR disorder_config (5)
.IR pkgconfdir/config .
See
.BR disorder_config (5)
This prevents multiple instances of DisOrder running simultaneously.
.SH ENVIRONMENT
.TP
This prevents multiple instances of DisOrder running simultaneously.
.SH ENVIRONMENT
.TP
+.B DISORDER_CONFIG
+Configuration file to use instead of
+.IR pkgconfdir/config .
+.TP
+.B DISORDER_PRIVCONFIG
+Private configuration file to use instead of
+.IR pkgconfdir/config.private .
+.TP
.B LC_ALL\fR, \fBLANG\fR, etc
Current locale.
See \fBlocale\fR(7).
.B LC_ALL\fR, \fBLANG\fR, etc
Current locale.
See \fBlocale\fR(7).
/** @brief Set the default configuration file */
static void set_configfile(void) {
#if !_WIN32
/** @brief Set the default configuration file */
static void set_configfile(void) {
#if !_WIN32
- if(!configfile)
- byte_xasprintf(&configfile, "%s/config", pkgconfdir);
+ if(!configfile) {
+ configfile = getenv("DISORDER_CONFIG");
+ if(!configfile)
+ byte_xasprintf(&configfile, "%s/config", pkgconfdir);
+ }
/** @brief Return the path to user's personal configuration file */
char *config_userconf(void) {
/** @brief Return the path to user's personal configuration file */
char *config_userconf(void) {
+ char *t;
+ if((t = getenv("DISORDER_USERCONFIG"))) return xstrdup(t);
return profile_filename("passwd");
}
return profile_filename("passwd");
}
char *s;
set_configfile();
char *s;
set_configfile();
- if(!strchr(pw->pw_name, '/')) {
+ if((s = getenv("DISORDER_USERCONFIG_SYS")))
+ return xstrdup(s);
+ else if(!strchr(pw->pw_name, '/')) {
byte_xasprintf(&s, "%s.%s", configfile, pw->pw_name);
return s;
} else
byte_xasprintf(&s, "%s.%s", configfile, pw->pw_name);
return s;
} else
char *t;
if(profiledir) return profiledir;
char *t;
if(profiledir) return profiledir;
+ if((t = getenv("DISORDER_HOME")))
+ profiledir = t;
+ else {
- wchar_t *wpath = 0;
- char *appdata;
- if(SHGetKnownFolderPath(&FOLDERID_RoamingAppData, 0, NULL, &wpath) != S_OK) {
- disorder_error(0, "error calling SHGetKnownFolderPath");
- return 0;
- }
- t = win_wtomb(wpath);
- CoTaskMemFree(wpath);
- byte_xasprintf(&profiledir, "%s\\DisOrder", appdata);
+ wchar_t *wpath = 0;
+ char *appdata;
+ if(SHGetKnownFolderPath(&FOLDERID_RoamingAppData, 0, NULL, &wpath) != S_OK) {
+ disorder_error(0, "error calling SHGetKnownFolderPath");
+ return 0;
+ }
+ t = win_wtomb(wpath);
+ CoTaskMemFree(wpath);
+ byte_xasprintf(&profiledir, "%s\\DisOrder", appdata);
- struct passwd *pw;
- if(!(t = getenv("HOME"))) {
- if(!(pw = getpwuid(getuid())))
- disorder_error(0, "user not found in password database");
- t = pw->pw_dir;
- }
- byte_xasprintf(&profiledir, "%s/.disorder", t);
+ struct passwd *pw;
+ if(!(t = getenv("HOME"))) {
+ if(!(pw = getpwuid(getuid())))
+ disorder_error(0, "user not found in password database");
+ t = pw->pw_dir;
+ }
+ byte_xasprintf(&profiledir, "%s/.disorder", t);