hooray~~ls
This commit is contained in:
parent
de9119d40b
commit
47bed3d287
1 changed files with 2 additions and 1 deletions
|
|
@ -2,13 +2,14 @@
|
|||
[connect_pool] with parameter [?post_connect] for preflight *)
|
||||
let db_conn =
|
||||
let f Env.{ sw; stack; tcp; dns; fs= _ } =
|
||||
Logs.info (fun m -> m "Connecting to database ...");
|
||||
let db_uri = Config.Exchangedb_postgres.config in
|
||||
match Caqti_mnet.connect ~sw stack tcp dns db_uri with
|
||||
| Error err ->
|
||||
Fmt.failwith "Database connection failure: %a." Caqti_error.pp err
|
||||
| Ok conn ->
|
||||
let () = Pg.preflight conn in
|
||||
Logs.info (fun m -> m "database connection initialized");
|
||||
Logs.info (fun m -> m "... connection done.");
|
||||
conn
|
||||
in
|
||||
let finally (module Conn : Pg.CONN) = Conn.disconnect () in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue