Module Restful.Config

module Config: sig .. end

Module for handling config files in refer format.

A config file consists of a bunch of records, each with a unique key field. This module parses and (optionally) validates the config file and selects the record identified by a given key; the other fields in this record can be used for configuration purposes.


type init = 
| Good of Kwrefer.refermap Kwrefer.SM.t
| Bad of string

The type of initialization results.

val load : ?validate:(?loc:string ->
Kwrefer.SS.t Kwrefer.SM.t * Kwrefer.validation_error list ->
int ->
(Kwrefer.SM.key * Kwrefer.SS.elt) list ->
Kwrefer.SS.t Kwrefer.SM.t * Kwrefer.validation_error list) ->
string -> string -> init

load ?validate key filename: load the config file in the given filename.

A suitable validation function can be realized with Kwrefer.validate and a proper refer schema.

validate : function used to validate the config file (default: does no validation)
val loadenv : ?validate:(?loc:string ->
Kwrefer.SS.t Kwrefer.SM.t * Kwrefer.validation_error list ->
int ->
(Kwrefer.SM.key * Kwrefer.SS.elt) list ->
Kwrefer.SS.t Kwrefer.SM.t * Kwrefer.validation_error list) ->
string -> string -> init

loadenv ?validate key var: load the config file named in an environment variable.

Version of Restful.Config.load possibly convenient for use in CGI mode.

validate : as per Restful.Config.load
val dump : string list Kwrefer.SM.t Kwrefer.SM.t -> (Kwrefer.SM.key * string) list list

dump: I'm sure this dumps something!