8 Configuration
Xiden dynamically binds configurable values using settings when launched. A runtime configuration is a parameterization in which every setting defined by xiden/rc is bound to a value that cannot be overridden except by another parameterization.
8.1 Settings
(require xiden/setting) | package: xiden |
A setting is an instance of the setting structure. Settings are used as a canonical source of dynamically bound values, along with validation information and contextual help.
struct
id : symbol? valid? : predicate/c parameter : parameter? derived-parameter : parameter?
setting implements prop:procedure. For an instance S:
(S) is ((setting-derived-parameter S)).
(S val proc) applies the procedure proc in a parameterization where (setting-derived-parameter S) is val.
syntax
(define-setting id contract-expr default-expr)
contract-expr must evaluate to a flat contract. Any attempt to install a value in the setting that does not pass this contract will fail.
default-expr must evaluate to either a (-> symbol? any/c) procedure, or a non-procedure. The procedure form must accept id (as a symbol) as the sole formal argument and return a default value.
(define-setting PICKED_NUMBER (integer-in 0 100) 0)
procedure
(call-with-applied-settings settings thunk) → any
settings :
(if/c hash? (hash/c setting? any/c) (listof (cons/c setting? any/c))) thunk : (-> any)
(define-setting USERNAME string? "") (define-setting PASSWORD string? "") (call-with-applied-settings (hasheq USERNAME "insecure" PASSWORD "hunter2") PASSWORD) (call-with-applied-settings (list (cons USERNAME "insecure") (cons PASSWORD "hunter2")) PASSWORD)
8.2 Runtime Configuration
(require xiden/rc) | package: xiden |
xiden/rc provides several settings that change how Xiden behaves. This section documents each setting with its command-line flags, contract, and default value.
8.2.1 Changing a Runtime Configuration Value
Here are the ways one can change a setting. Each method overrides the method before it.
Do nothing. Every setting has a hard-coded default.
Set an environment variable, e.g. export XIDEN_VERBOSE="#t".
Open an rcfile and add (define XIDEN_VERBOSE #t).
When applicable, use --XIDEN_VERBOSE '#t' in a command line (or an alternative flag).
In a program, use (XIDEN_VERBOSE #t (lambda () ...)).
8.2.2 Runtime Configuration Files
#lang xiden/rcfile | package: xiden |
A runtime configuration file, or rcfile, is a xiden/rcfile Racket module. It defines values for a runtime configuration using identifiers that match the setting-id of each defined setting. e.g. (define XIDEN_VERBOSE #t).
The target runtime configuration file, or target rcfile, is located at etc/xiden.rkt with respect to the target workspace.
The xiden/rcfile collection path can be used as a module language or as a reader extension.
The grammar is a superset of setup/infotab, or the info language. It includes the following bindings:
8.2.3 Runtime Configuration API
value
XIDEN_SETTINGS : (hash/c symbol? setting? #:immutable #t)
procedure
(call-with-rcfile thunk) → any
thunk : (-> any)
Each call to call-with-rcfile reads the content of the target rcfile into memory.
procedure
8.2.4 Setting Reference
These are the defined settings for Xiden, along with their default values and command-line flags.
setting
XIDEN_MEMORY_LIMIT_MB : (>=/c 0) = 200
Does not count memory charged when parsing the command line and setting up a runtime configuration.
Has no effect if the running Racket installation does not support per-custodian memory accounting.
setting
XIDEN_TIME_LIMIT_S : (>=/c 0) = 300
Each list in XIDEN_INSTALL_SOURCES consists of three strings:
The path to a symbolic link to create with respect to (current-directory).
The name of a desired output from a package definition.
A URL, file path, or plugin-specific string used to find the package definition.
setting
The path of a symbolic link to create with respect to (current-directory).
A URL, file path, or plugin-specific string used to find the package definition.
The output is assumed to be "default".
setting
XIDEN_PLUGIN_MODULE : (or/c #f path-string?) = #f
setting
XIDEN_TRUST_UNSIGNED : boolean? = #f
setting
setting
setting
XIDEN_TRUST_BAD_DIGEST : boolean? = #f
setting
setting
setting
: (listof well-formed-integrity-info/c) = ()
setting
: (listof well-formed-integrity-info/c) = ()
Beware: Any executable listed here inherits the OS-level permissions of the process, and is not subject to the restrictions of a Xiden runtime configuration. If you include a Xiden launcher or a sufficiently flexible Racket launcher, a package can start a new Xiden process with a full-trust configuration.
setting
XIDEN_TRUSTED_HOST_EXECUTABLES : (listof string?) = ()
This can be helpful in the event a package depends on access to an executable on the host system and there is no way to control the content of that executable.
The find-executable-path restriction is meant to prevent packages from creating and then immediately running their own executables just because they have a name in this list. Even so, this can be a dangerous setting, and should only be used if you trust both the package definition and the executables on your system. It’s also why PATH should not include a build directory.
Regardless of the setting’s actual value, Xiden implicitly considers "openssl" an element of its list. The user is therefore responsible for the integrity of their OpenSSL instance.
setting
XIDEN_FASL_OUTPUT : boolean? = #f
setting
Use this to produce (read)able logs. If it aids read performance, combine with XIDEN_FASL_OUTPUT.
setting
XIDEN_FETCH_TOTAL_SIZE_MB : (or/c +inf.0 real?) = 100
setting
XIDEN_FETCH_BUFFER_SIZE_MB : (real-in 0.1 20) = 10
setting
XIDEN_FETCH_PKGDEF_SIZE_MB : (real-in 0.1 20) = 0.1
setting
XIDEN_FETCH_TIMEOUT_MS : (real-in 100 10000) = 3000
setting
XIDEN_VERBOSE : boolean? = #f
setting
= ("https://zcpkg.com/$QUERY")
This setting affects the output of from-catalogs.
setting
XIDEN_DOWNLOAD_MAX_REDIRECTS : exact-nonnegative-integer? = 2
setting
setting
: (listof (or/c bytes-environment-variable-name? string?)) = ()
"PATH" is included regardless of the value of this setting.
setting
XIDEN_SUBPROCESS_TIMEOUT_S : (>=/c 0) = 1800
setting
: (listof (list/c (or/c symbol? string? regexp? pregexp? byte-regexp? byte-pregexp?) (listof any/c))) = ()
Each element is in the form (cons pattern input-expr). The input of name input-name is replaced with the (evaluated) input-expr for all package queries matching pattern.
If pattern is a string, then it is used as an argument to pregexp before matching. If pattern is a symbol, then it is first coerced to a string and then used as an argument to pregexp.
setting
XIDEN_GENERATED_INPUT_NAME : string? = "default"
setting
: (or/c 'base64 'base32 'hex 'colon-separated-hex) = base64
setting
: (or/c 'md4 'md5 'sha1 'sha224 'sha256 'sha3-224 'sha3-256 'sha3-384 'sha3-512 'sha384 'sha512 'sha512-224 'sha512-256) = sha384
setting
: (list/c (or/c #f string?) (or/c #f path-string?) (or/c #f path-string?)) = (#f#f#f)
Xiden will attempt to sign input expressions when at least a public key source and private key is available.