Something went wrong. Try again.
A local Git merge queue with content-bound gate verdicts
Something went wrong. Try again.
2.3 kB · 59 lines
OCaml
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960open Cmdlineropen Cmdliner.Term.Syntaxmodule Command_web = Merge_queue_web_command.Command_webopen Merge_queue_eio
let action out : Common.action Term.t = let+ out and+ socket = let doc = "Listen on a Unix socket at $(docv), created readable and writable by \ its user alone, with no capability in the paths, instead of the \ loopback address." in Arg.( value & opt (some Common.fpath) None & info [ "socket" ] ~docv:"PATH" ~doc) and+ port = let doc = "Listen on port $(docv) of the loopback address (default: one the system \ chooses)." in Arg.(value & opt (some int) None & info [ "port" ] ~docv:"N" ~doc) in fun ctx -> match Command_web.run ~net:(Eio.Stdenv.net ctx.Command.env) ~domain_mgr:(Eio.Stdenv.domain_mgr ctx.env) ~cwd:ctx.cwd (Command_web.source ctx) ~socket ~port ~on_listen:Common.line with | Ok () -> Common.ok | Error o -> Common.outcome out o
let cmd = let man = [ `S Manpage.s_description; `P "Serves the queues of every repository a registration of this \ machine's user runs mq in (the launch agents and the systemd services \ $(b,mq schedule start) writes), until it is stopped. It prints the \ URL to open, which carries the session's capability; a request \ without it is refused. It binds the loopback address only. Each \ repository's status is read once per move of its journal, waiting for \ no lock as $(b,mq status) does, and kept: a request is answered from \ what is kept."; `P "Beside the page, the same URL serves $(b,machine.json), the \ registered repositories by the name of their registration, \ $(b,health.json), the line $(b,mq status --all --json) prints, and \ for each, $(b,r/NAME/status.json) and $(b,r/NAME/stats.json?since=D), \ the lines $(b,mq status --json) and $(b,mq stats --json --since D) \ print for that repository, and $(b,events), a stream of server-sent \ events carrying each repository's status as it is read."; ] in Common.v "web" ~exits:Read ~doc:"Serve this machine's queues to a browser and to HTTP clients." ~man action