package datakit-ci

  1. Overview
  2. Docs
module Wm : Webmachine.S with type 'a io = 'a Lwt.t
type role = [
  1. | `Reader
  2. | `LoggedIn
  3. | `Builder
  4. | `Admin
]

Roles are:

  • Reader permitted to look at the CI state, build logs, etc
  • LoggedIn must be logged in (not anonymous)
  • Builder permitted to control the builds (cancel, rebuild)
  • Admin is an administrator
module User : sig ... end
module Auth : sig ... end
type server
val server : auth:Auth.t -> web_config:CI_web_templates.t -> session_backend: [< `Memory | `Redis of Redis_lwt.Client.connection Lwt_pool.t ] -> public_address:Uri.t -> server
val web_config : server -> CI_web_templates.t
module Session_data : sig ... end
class type resource = object ... end
class static : valid:Str.regexp -> mime_type:(Uri.t -> string option) -> string -> resource

new static ~valid ~mime_type dir serves up files from the directory dir, taking the leafname from the context. Names must match the RE valid and the MIME type returned will be mime_type uri.

class static_crunch : mime_type:(Uri.t -> string option) -> (string -> string option) -> resource

new static_crunch ~mime_type read serves up files using the function read, taking the path from the context. The MIME type returned will be mime_type uri.

class virtual resource_with_session : server -> object ... end

resource_with_session ensures there is a session for each request.

Page to serve at /auth/login.

Page to serve at /auth/intro/:token.

Page to serve at /auth/setup.

Page to serve at /auth/github-callback

class virtual protected_page : server -> object ... end

The is_authorized method checks that the session has an associated user and asks the user to log in if not. authenticated_user returns the name of the user once is_authorized has completed.

class virtual post_page : server -> object ... end

post_page accepts form POST submissions. It overrides forbidden to check that the CSRF token is present and correct.

Posting to this page logs the user out and redirects to /.

val serve : mode:Conduit_lwt_unix.server -> routes:(string * (unit -> Cohttp_lwt.Body.t Wm.resource)) list -> unit Lwt.t

serve ~mode ~routes runs a web-server listening on mode that dispatches incoming requests using routes.

class virtual html_page : server -> object ... end
class virtual 'a form_page : server -> object ... end

The GitHub authentication settings page.