Backend.Conf
Backend configuration.
A backend configuration is a set of keys mapping to typed values. Backends define their own keys.
A configuration converter transforms a string value to an OCaml value and vice-versa.
module Spec : sig ... end
val key :
?docs:string ->
?docv:string ->
?doc:string ->
?allow_duplicate:bool ->
spec:Spec.t ->
string ->
'a Type.t ->
'a ->
'a key
key ~docs ~docv ~doc ~spec name conv default
is a configuration key named name
that maps to value default
by default. It will be associated with the config grouping spec
. conv
is used to convert key values provided by end users.
docs
is the title of a documentation section under which the key is documented. doc
is a short documentation string for the key, this should be a single sentence or paragraph starting with a capital letter and ending with a dot. docv
is a meta-variable for representing the values of the key (e.g. "BOOL"
for a boolean).
val name : 'a key -> string
The key name.
val default : 'a key -> 'a
default k
is k
's default value.
val doc : 'a key -> string option
doc k
is k
's documentation string (if any).
val docv : 'a key -> string option
docv k
is k
's value documentation meta-variable (if any).
val docs : 'a key -> string option
docs k
is k
's documentation section (if any).
val pp : t Fmt.t
pp
is the pretty printer for configuration values.
equal
is the equality for configuration values. Two values are equal if they have the same pp
representation.
singleton spec k v
is the configuration where k
maps to v
.
val is_empty : t -> bool
is_empty c
is true
iff c
is empty.
verify t
is an identity function that ensures all keys match the spec
Raises. Invalid_argument
if t
contains invalid keys
val uri : Uri.t Type.t
uri
converts values with Uri
.of_string.
val find_root : t -> string option
find_root c
is root
's mapping in c
, if any.