Source file auth.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
type auth = {
  user : string;
  password : string;
  server : string option;
}

let v ~auth ~server =
  Option.map (fun (user, password) -> { user; password; server }) auth

let login ?config ~docker_context ~job = function
  | None -> Lwt.return (Ok ())
  | Some { user; password; server } ->
      let cmd = Cmd.login ?config ~docker_context ?server user in
      Current.Process.exec ~cancellable:true ~job ~stdin:password cmd