add --postgres-password cmdline arg + make keys
This commit is contained in:
parent
42b7e13eae
commit
6cb6a96784
11 changed files with 84 additions and 53 deletions
31
src/mte.ml
31
src/mte.ml
|
|
@ -50,10 +50,9 @@ let routes =
|
|||
|
||||
module RNG = Mirage_crypto_rng.Fortuna
|
||||
|
||||
let t0 = Mkernel.clock_monotonic ()
|
||||
|
||||
let () =
|
||||
let run postgres_password =
|
||||
let ( let@ ) finally fn = Fun.protect ~finally fn in
|
||||
let t0 = Mkernel.clock_monotonic () in
|
||||
Log_reporter.setup ~t0;
|
||||
let rng =
|
||||
let rng () = Mirage_crypto_rng_mkernel.initialize (module RNG) in
|
||||
|
|
@ -81,6 +80,30 @@ let () =
|
|||
Vifu.Devices.[ Mte_device.sm_eddsa; Mte_device.sm_rsa; Mte_device.pool ]
|
||||
in
|
||||
let handlers = [ Mte_handler.not_implemented_route ] in
|
||||
let env = { Env.sw; stack; tcp; dns; fs } in
|
||||
let env =
|
||||
let db_uri =
|
||||
Uri.of_string
|
||||
@@ Fmt.str "pgx://mte:%s@10.0.0.1:5432/taler-exchange" postgres_password
|
||||
in
|
||||
{ Env.sw; stack; tcp; dns; fs; db_uri }
|
||||
in
|
||||
Logs.info (fun m -> m "Starting MTE server");
|
||||
Vifu.run ~cfg ~devices ~handlers tcp routes env
|
||||
|
||||
open Cmdliner
|
||||
|
||||
(* todo: tls *)
|
||||
let postgres_password =
|
||||
let doc = "PostgreSQL password." in
|
||||
let open Arg in
|
||||
required & opt (some string) None & info [ "postgres-password" ] ~doc
|
||||
|
||||
let term =
|
||||
let open Term in
|
||||
const run $ postgres_password
|
||||
|
||||
let cmd =
|
||||
let info = Cmd.info "blame" in
|
||||
Cmd.v info term
|
||||
|
||||
let () = Cmd.(exit @@ eval cmd)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue