Preferences are key/value pairs used to store configuration settings. Both key and value are text strings. The key consists of three components:
By default all sources for configuration settings are inspected to find an entry. Only for security-relevant settings (settings forcing a program to skip security checks) programs should use command line options only.
If user "joe" runs application "myapp" on host "pc-joe" and the application needs the users preferred language, it attempts to get the preference value "/ui/lang" (user interface, language) from the following scopes:
joe/myapp/pc-joe | valid for user joe running application on host pc-joe | |
joe/myapp/* | valid for user joe running myapp on any host | |
joe/*/pc-joe | valid for user joe running any application on host pc-joe | |
joe/*/* | valid for user joe running any application on any host | |
*/myapp/pc-joe | valid for any user running myapp on host pc-joe | |
*/myapp/* | valid for any user running myapp on any host | |
*/*/pc-joe | valid for any user running any application on host pc-joe | |
*/*/* | valid for any user running any application on any host |
The first (most detailed) scope has highest priority, the last scope has lowest priority.
If there are different sources providing entries for the highest priority scope, the
sources are used in the order
Preferences are stored in files with an ini-file like syntax. Scopes given in square brackets are valid for all configuration settings following that scope until the next scope specification is found.
# for all users running any application on any host [*/*/*] # set the default language /ui/lang = en_US # ignore the LANG environment variable /ui/lang/env = off # user otto is coming from Germany... [otto/*/*] /ui/lang = de_DEExample for ${sysconfdir}/appdefaults.appname
# valid for all users on all hosts [*/*] /dir/app = /usr/local/myappIt's good practice to have settings of general interest (language selection, logging...) in ${sysconfdir}/appdefaults.
# my personal settings for all programs [*] /log/stdout/level = none /log/stderr/level = info # for myapp I want detailed info [myapp] /log/stderr/level = debugExample for a $HOME/.defaults/appname file (a $HOME/.defaults/createp file here):
/password/wlan-key/ascii85 = on /password/wlan-key/capitals = 0 /password/wlan-key/digits = 2 /password/wlan-key/length = 128 /password/wlan-key/passwd-only = off /password/wlan-key/specials = 0 /password/type = user /password/user/ascii85 = off /password/user/capitals = 0 /password/user/digits = 2 /password/user/length = 6 /password/user/passwd-only = off /password/user/specials = 0
The $HOME/.defaults/all file is maintained by the user manually.
The $HOME/.defaults/appname files are created, modified or
removed by applications if the -c or -u option is used.
If there is a key/value pair before the first scope specification
or there is no scope specification at all, settings are in the lowest
priorized scope ("*/*/*". "*/*" or "*").
On Windows systems the registry is used to store preferences.
The preferences storage in the registry was changed significantly in
dklibs version 1.17.0.
The purpose is to avoid unnecessary typing of scopes in registry entry
names and to allow some preferences to "survive" a --unconfigure
operation.
Name | Source | Programs | Contents |
---|---|---|---|
/ui/lang | any | any | language code language_country.encoding, i.e. en_US or de_DE.UTF-8 |
/ui/lang/env | any | any | boolean value (i.e. "on" or "off"), indicates whether or not the LANG environment variable overrides the setting in /ui/lang. |
Name | Source | Programs | Contents |
---|---|---|---|
/dir/app | any | any | the application-specific directory to search for resources |
/dir/shared | any | any | the directory to search for resources shared by multiple applications |
Name | Source | Programs | Contents |
---|---|---|---|
/dir/tmp | any | any | base directory for temporary files (each application process creates a subdirectory) |
/dir/tmp/keep | any | any | boolean value to indicate whether or not the processes temporary directory is kept (not deleted) when the program calls dkapp_close() before exiting. By default temporary directories are removed. Sometimes you may want to keep them for debugging purposes. |
Name | Source | Programs | Contents |
---|---|---|---|
/log/file/name | any | any | name of the log file to create |
/log/file/level | any | any | minimum priority of messages to be logged to file (lower priority messages are skipped), may be "none", "panic", "fatal", "error", "warning", "info", "progress" or "debug". The recommended range is "error" ... "progress". |
/log/file/keep | any | any | minimum priority of messages required to keep the log file. By default the log file is deleted if the application calls dkapp_close() before exiting. Sometimes you may want to keep the log file for debugging purposes. |
/log/file/codepage | any | any | codepage to use for log messages going to file |
/log/file/time | any | any | boolean value to indicate whether or not to write time stamps with log messages |
/log/file/split | any | any | boolean value to indicate whether or not to create separated lines for time stamps (if time stamp printing is enabled) |
/log/file/ide | any | any | output lines can imitate the style of some widely used developer tools for better integration with make or IDEs. Use one of the following values:
|
/log/stdout/level /log/stdout/time /log/stdout/split /log/stdout/codepage /log/stdout/ide /log/stderr/level /log/stderr/time /log/stderr/split /log/stderr/codepage /log/stderr/ide |
any | any | settings for logging to stdout and stderr. See /log/file/... above. |
Name | Source | Programs | Contents |
---|---|---|---|
/storage/trees | any | any | boolean value, indicates whether or not tree structures can be used for sorted containers. You should leave this setting at the builtin defaults. |
Name | Source | Programs | Contents |
---|---|---|---|
/sec/ign/link-owner | cmd line | any | boolean value, allows to skip the check whether or not the owner of a symbolic link is the owner of the link target |
/sec/ign/dir-group-writable | cmd line | any | boolean value, allows to skip the check whether or not a symbolic link resides in a group-writable directory |
/sec/ign/dir-world-writable | cmd line | any | boolean value, allows to skip the check whether or not a symbolic link resides in a group-writable or world-writable directory |
Name | Source | Programs | Contents |
---|---|---|---|
/openssl/allow-random-seed-file | system | createp | boolean value, indicates whether or not a file may be used to seed the OpenSSL PRNG. This can be used to deny using random seed files for users having their home directories on NFS file systems. The default "on" allows the use of random seed files if this preference is not set. |
/openssl/random-seed-file | any | createp rndbytes |
name of the random seed file |
/openssl/egd-socket | any | createp rndbytes |
name of an EGD socket which can be used to seed the OpenSSL PRNG. |
The "/log/file/name", "/dir/app", "/dir/shared" and "/dir/tmp" preferences
can use macros (placeholders) in the definitions:
Macro | Meaning |
---|---|
$(app.name) | application name |
$(user.name) | the users login name |
$(user.home) | the users home directory |
$(user.uid) | the users UID |
$(user.gid) | the users GID |
$(user.euid) | the users effective UID |
$(user.egid) | the users effective GID |
$(host.name) | the short host name (computer name) |
$(host.domain) | the hosts DNS domain name |
$(app.dir) | the application directory (can not be used to define "/dir/app") |
$(shared.dir) | the shared directory (can not be used to define "/dir/shared" or "/dir/app") |
$(temp.dir) | the temporary directory (can not be used to define "/dir/tmp", "/dir/shared" or "/dir/app") |
$(process.pid) | the PID of the current process |
$(process.ppid) | the PID of the parent process |
$(process.pgid) | the process group ID |
Example:
"/dir/app"="/usr/local/share/$(app.name)" "/log/file/name"="$(temp.dir)/$(app.name).$(process.pid).log"
[*] /ui/lang/env = off /ui/lang = de_DE
[*] /ui/lang = en_US
[tadeusz] /ui/lang = pl [tadeusz/myapp1/*] /ui/lang = en_US
[*] /ui/lang = sp [myapp1/*] /ui/lang = en_USto his $HOME/.defaults/all file
"/ui/lang"="de_DE" "/ui/lang/env"="off"to the HKLM\Software\DkApp key.
"/ui/lang"="en_US"in the HKLM\Software\DkApp\myapp1 key.
"tadeusz:/ui/lang"="pl"to HKLM\Software\DkApp
"tadeusz:/ui/lang"="en_US"to HKLM\Software\DkApp\myapp1.
"tadeusz/myapp1:/ui/lang"="en_US"to HKLM\Software\DkApp.
"/ui/lang"="sp"to HKCU\Software\DkApp
"/ui/lang"="en_US"to HKCU\Software\DkApp\myapp1.