Module Mavryk_proxy_server_config.Proxy_server_config

type t = private {
  1. endpoint : Uri.t option;
    (*

    The node to delegate RPCs to. Name was chosen to be the same as in mavkit-client

    *)
  2. rpc_addr : Uri.t option;
    (*

    The address that the proxy server serves. Name was chosen to be the same as in mavkit-node run

    *)
  3. rpc_tls : string option;
    (*

    A string of the form "crt,key" where crt is the path to the TLS certificate to use and key is the path to the key to use. Name was chosen to be the same as in mavkit-node run

    *)
  4. sym_block_caching_time : Ptime.span option;
    (*

    The time during which data for a symbolic block identifier (like head, head~1) is kept. Smaller values increase endpoint's load but yield more up-to-date to clients. Higher values decrease endpoint's load but make clients observe slightly deprecated values. If omitted, defaulted to time_between_blocks.

    If you are not sure what to do, do not specify it; i.e. do not pass --sym-block-caching-time. If your node's load is too high, pass a bigger value than time_between_blocks (if your clients are fine seeing slightly deprecated values)

    *)
  5. data_dir : string option;
    (*

    Path to the data-dir of a running mavkit-node. If specified, we use the context subdirectory to obtain data instead of using the ../raw/bytes RPC call (hereby reducing the node's IO).

    *)
}

This type corresponds to the content of the CONFIG file, as well as the aggregations of the corresponding command line arguments. Once it is built and, it is transformed into a value of type runtime which represents what the APIs actually needs.

val pp : Stdlib.Format.formatter -> t -> unit

Pretty printer for t

type runtime = private {
  1. endpoint : Uri.t;
    (*

    The node to delegate RPCs to.

    *)
  2. rpc_server_address : Mavryk_base.TzPervasives.P2p_addr.t;
    (*

    The address of the server

    *)
  3. rpc_server_port : int;
    (*

    The port of the server

    *)
  4. rpc_server_tls : (string * string) option;
    (*

    The paths to the certificate and key to use for TLS

    *)
  5. sym_block_caching_time : Ptime.span option;
    (*

    The duration during which data of symbolic blocks is kept

    *)
  6. data_dir : string option;
    (*

    Path to the data-dir of a running mavkit-node. If specified, we use the context subdirectory to obtain data instead of using the ../raw/bytes RPC call (hereby reducing the node's IO).

    *)
}

A value of type t after having been appropriately validated and prepared for being passed to the various APIs that need them (hence some types are slightly different than in t).

val make : endpoint:Uri.t option -> rpc_addr:Uri.t option -> rpc_tls:string option -> sym_block_caching_time:Ptime.span option -> data_dir:string option -> t

make endpoint rpc_addr rpc_tls sym_block_caching_time creates an instance of t from the flags that are available on the command line. See t for the documentation of parameters.

val example_config : string

Valid config file: if passed to destruct_config, Valid is returned.

type 'a destructed =
  1. | Valid of 'a
    (*

    File could be parsed and validated

    *)
  2. | Invalid of string
    (*

    File could be parsed but not validated. Message is detailed.

    *)
  3. | CannotDeserialize
    (*

    Deserializing the JSON failed.

    *)

Encoding of what may happen when deserializing a JSON value whose OCaml type is 'a

val destruct_config : Mavryk_base.TzPervasives.Data_encoding.json -> t destructed

destruct_config json returns a t from raw json. Returns Ok in case of success, or Error msg if validation fails.

val union_right_bias : t -> t -> t

merge_right_bias t1 t2 returns the union of data of t1 and t2 (taking the Some case on fields of type option). If data is present on both side, take data from t2

val to_runtime : t -> (runtime, string) Stdlib.result

to_runtime t returns a runtime from a t. Returns Ok in case of success, or Error msg if validation fails.