This commit is contained in:
parent
fdd36332f9
commit
c6989be4c7
1 changed files with 3 additions and 22 deletions
25
src/mte.ml
25
src/mte.ml
|
|
@ -64,23 +64,6 @@ let routes =
|
||||||
in
|
in
|
||||||
tos @ status_info @ management
|
tos @ status_info @ management
|
||||||
|
|
||||||
let caqti_get_ok = function
|
|
||||||
| Error e -> Fmt.failwith "%a" Caqti_error.pp e
|
|
||||||
| Ok v -> v
|
|
||||||
|
|
||||||
let test (module Conn : Caqti_miou.CONNECTION) =
|
|
||||||
let minus_req =
|
|
||||||
let open Caqti_request.Infix in
|
|
||||||
let open Caqti_type in
|
|
||||||
(t2 int int ->! int) "SELECT ? - ?"
|
|
||||||
in
|
|
||||||
let a = 22 in
|
|
||||||
let b = 17 in
|
|
||||||
let c = Conn.find minus_req (22, 17) |> caqti_get_ok in
|
|
||||||
assert (a - b = c);
|
|
||||||
Logs.app (fun f -> f "%d - %d = %d" a b c);
|
|
||||||
()
|
|
||||||
|
|
||||||
module RNG = Mirage_crypto_rng.Fortuna
|
module RNG = Mirage_crypto_rng.Fortuna
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
|
|
@ -104,7 +87,7 @@ let () =
|
||||||
let dns = Mnet_dns.create (udp, he) in
|
let dns = Mnet_dns.create (udp, he) in
|
||||||
let t = Mnet_dns.transport dns in
|
let t = Mnet_dns.transport dns in
|
||||||
let@ () = fun () -> Mnet_dns.Transport.kill t in
|
let@ () = fun () -> Mnet_dns.Transport.kill t in
|
||||||
|
(* -- *)
|
||||||
Caqti_miou.Switch.run @@ fun sw ->
|
Caqti_miou.Switch.run @@ fun sw ->
|
||||||
let db_conn =
|
let db_conn =
|
||||||
let db_uri = Config.Exchangedb_postgres.config in
|
let db_uri = Config.Exchangedb_postgres.config in
|
||||||
|
|
@ -115,13 +98,12 @@ let () =
|
||||||
in
|
in
|
||||||
let@ () =
|
let@ () =
|
||||||
fun () ->
|
fun () ->
|
||||||
let (module Conn : Caqti_miou.CONNECTION) = db_conn in
|
let (module Conn : Pg.CONN) = db_conn in
|
||||||
Conn.disconnect ()
|
Conn.disconnect ()
|
||||||
in
|
in
|
||||||
|
|
||||||
let () = Pg.preflight db_conn in
|
let () = Pg.preflight db_conn in
|
||||||
Logs.info (fun m -> m "database connection initialized");
|
Logs.info (fun m -> m "database connection initialized");
|
||||||
|
(* -- *)
|
||||||
let keys : (module Keys.S) =
|
let keys : (module Keys.S) =
|
||||||
let (module Conn : Pg.CONN) = db_conn in
|
let (module Conn : Pg.CONN) = db_conn in
|
||||||
let (module Fs : Fat.FS) =
|
let (module Fs : Fat.FS) =
|
||||||
|
|
@ -131,7 +113,6 @@ let () =
|
||||||
in
|
in
|
||||||
(module Keys.Make (Conn) (Fs))
|
(module Keys.Make (Conn) (Fs))
|
||||||
in
|
in
|
||||||
|
|
||||||
(* -- *)
|
(* -- *)
|
||||||
let cfg = Vifu.Config.v Config.Exchange.port in
|
let cfg = Vifu.Config.v Config.Exchange.port in
|
||||||
Vifu.run ~cfg tcp routes (db_conn, keys)
|
Vifu.run ~cfg tcp routes (db_conn, keys)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue