fix days in generate

This commit is contained in:
Hannes Mehnert 2018-11-23 21:13:54 +01:00
parent b5a068555c
commit 0ced2ebad1

View file

@ -57,7 +57,6 @@ let sign_csr dbname cacert key csr days =
| Error e -> Error e | Error e -> Error e
let sign _ db cacert cakey csrname days = let sign _ db cacert cakey csrname days =
let days = match days with None -> 1 | Some x -> x in
Nocrypto_entropy_unix.initialize () ; Nocrypto_entropy_unix.initialize () ;
match match
Bos.OS.File.read (Fpath.v cacert) >>= fun cacert -> Bos.OS.File.read (Fpath.v cacert) >>= fun cacert ->
@ -77,7 +76,6 @@ let help _ man_format cmds = function
| Some _ -> List.iter print_endline cmds; `Ok () | Some _ -> List.iter print_endline cmds; `Ok ()
let generate _ name db days sname sdays = let generate _ name db days sname sdays =
let days = match days with None -> 3650 | Some x -> x in
Nocrypto_entropy_unix.initialize () ; Nocrypto_entropy_unix.initialize () ;
match match
Vmm_provision.priv_key ~bits:4096 None name >>= fun key -> Vmm_provision.priv_key ~bits:4096 None name >>= fun key ->
@ -105,7 +103,7 @@ let key =
let days = let days =
let doc = "Number of days" in let doc = "Number of days" in
Arg.(value & opt (some int) None & info [ "days" ] ~doc) Arg.(value & opt int 3650 & info [ "days" ] ~doc)
let db = let db =
let doc = "Database" in let doc = "Database" in
@ -128,6 +126,10 @@ let generate_cmd =
Term.(ret (const generate $ setup_log $ Vmm_provision.nam $ db $ days $ sname $ sday)), Term.(ret (const generate $ setup_log $ Vmm_provision.nam $ db $ days $ sname $ sday)),
Term.info "generate" ~doc ~man Term.info "generate" ~doc ~man
let days =
let doc = "Number of days" in
Arg.(value & opt int 1 & info [ "days" ] ~doc)
let sign_cmd = let sign_cmd =
let doc = "sign a request" in let doc = "sign a request" in
let man = let man =