4 Configuration
(require koyo/config) | package: koyo-lib |
This module provides the define-option macro which facilitates reading environment variables, transforming them and providing them as Racket values.
syntax
(define-option name maybe-default e ...)
maybe-default =
| #:default default
Defines and provides an option called name. The name is
uppercased, prefixed with current-option-name-prefix and
has its dashes replaced with underscores; the resulting value is
then passed to getenv. If the environment variable is not
set, then default is used and if default isn’t
provided, then the value will be #f.
name is bound inside the body of the define so options can be pre-processed. For example:
(define-option debug (equal? debug "x")) (define-option concurrency #:default "4" (string->number concurrency))
parameter
(current-option-name-prefix prefix) → void? prefix : string?
= "KOYO"
Defines the prefix for option names as environment variables.