Module Ketrew_configuration (.ml)

module Ketrew_configuration: sig .. end
Definition of the configuration (input to state creation; contents of the config-file).


Construct Configuration Values


type t 
The contents of a configuration.
type plugin = [ `Compiled of string | `OCamlfind of string ] 
The 2 kinds of dynamically loaded “plugins” accepted by Ketrew:


type explorer_defaults 
Configuration of the Explorer text-user-interface. These configuration values can be changed at runtime within the explorer; but they are not persistent in that case.
val default_explorer_defaults : explorer_defaults
The default values of the Explorer configuration.
val explorer : ?request_targets_ids:[ `All | `Younger_than of [ `Days of float ] ] ->
?targets_per_page:int ->
?targets_to_prefetch:int -> unit -> explorer_defaults
Create a configuration of the Explorer:


type ui 
General configuration of the text-based user interface.
val ui : ?with_color:bool ->
?explorer:explorer_defaults ->
?with_cbreak:bool -> unit -> ui
Create a configuration of the UI:


type engine 
The configuration of the engine, the component that orchestrates the run of the targets (used both for standalone and server modes).
val engine : ?database_parameters:string ->
?turn_unix_ssh_failure_into_target_failure:bool ->
?host_timeout_upper_bound:float ->
?maximum_successive_attempts:int -> unit -> engine
Build an engine configuration:


type authorized_tokens 
This type is a container for one more authentication-tokens, used by the server's HTTP API

Tokens have a name and a value; the value is the one checked against the "token" argument of the HTTP queries.

val authorized_token : name:string -> string -> authorized_tokens
Create an “inline” authentication token, i.e. provide a name and a value directly.
val authorized_tokens_path : string -> authorized_tokens
Ask the server to load tokens from a file at the given path.

The file uses the SSH authorized_keys format. I.e. whitespace-separated lines of the form:

      <name> <token> <optional comments ...>
     

type server 
The configuration of the server.
val server : ?ui:ui ->
?engine:engine ->
?authorized_tokens:authorized_tokens list ->
?return_error_messages:bool ->
?command_pipe:string ->
?daemon:bool ->
?log_path:string ->
[ `Tls of string * string * int ] ->
[> `Server of server ]
Create a server configuration (to pass as optional argument to the Ketrew_configuration.create function).


type standalone 
val standalone : ?ui:ui ->
?engine:engine ->
unit -> [> `Standalone of standalone ]
type client 
Configuration of the client (as in HTTP client).
val client : ?ui:ui ->
token:string -> string -> [> `Client of client ]
Create a client configuration:


type mode = [ `Client of client
| `Server of server
| `Standalone of standalone ]
Union of the possible configuration “modes.”
val create : ?debug_level:int ->
?plugins:plugin list ->
mode -> t
Create a complete configuration:


type profile 
A profile is a name associated with a configuration.
val profile : string -> t -> profile
Create a profile value.

Output/Serialize Configuration Profiles


val output : profile list -> unit
Output a configuration file containing a list of profiles to stdout.
val to_json : profile list -> string
Create the contents of a configuration file containing a list of profiles.

Access Configuration Values


val default_database_path : string
Default path to the database (used when generating custom configuration files).
val database_parameters : engine -> string
Get the database parameters.
val is_unix_ssh_failure_fatal : engine -> bool
Should we kill targets on ssh/unix errors.
val maximum_successive_attempts : engine -> int
Get the maximum number of successive non-fatal failures.
val plugins : t -> plugin list
Get the configured list of plugins.
val mode : t -> mode
val standalone_engine : standalone -> engine
val server_engine : server -> engine
val server_configuration : t -> server option
Get the potentiel server configuration.
val authorized_tokens : server ->
[ `Inline of string * string | `Path of string ] list
The path to the authorized_tokens file.
val listen_to : server -> [ `Tls of string * string * int ]
Get the OpenSSL server configuration.
val return_error_messages : server -> bool
Get the value of return_error_messages.
val command_pipe : server -> string option
Get the path to the “command” named pipe.
val daemon : server -> bool
Tell whether the server should detach.
val log_path : server -> string option
Get the path to the server's log file.
val log : t -> Ketrew_pervasives.Log.t
Get a display-friendly list of configuration items.
val connection : client -> string
val token : client -> string
val standalone_of_server : server -> standalone
val with_color : t -> bool
val request_targets_ids : t -> [ `All | `Younger_than of [ `Days of float ] ]
val targets_per_page : t -> int
val targets_to_prefetch : t -> int
val use_cbreak : unit -> bool
See the documentation of with_cbreak.
val load_exn : ?and_apply:bool ->
?profile:string ->
[ `From_path of string
| `Guess
| `In_directory of string
| `Override of t ] -> t
Load a configuration.

If and_apply is true (the default), then global settings are applied and plugins are loaded.

When the configuration comes from a file, the argument profile allows to load a given profile. If None then the loading process will try the "KETREW_PROFILE" environment variable, or use the name "default".

The last argument tells the functions how to load the configuration: