Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 00f86743 authored by Stephane Glondu's avatar Stephane Glondu

Make AUTH_SYSTEM.parse_config side-effect-free

parent ca6a6511
......@@ -135,13 +135,10 @@ end
let name = "cas"
let parse_config ~instance ~attributes =
let parse_config ~attributes =
match attributes with
| ["server", server] -> {server}
| _ ->
Printf.ksprintf failwith
"invalid configuration for instance %s of auth/%s"
instance name
| ["server", server] -> Some {server}
| _ -> None
let make {server} =
let module C = struct let server = server end in
......
......@@ -27,13 +27,10 @@ type config = unit
let name = "dummy"
let parse_config ~instance ~attributes =
let parse_config ~attributes =
match attributes with
| [] -> ()
| _ ->
Printf.ksprintf failwith
"invalid configuration for instance %s of auth/%s"
instance name
| [] -> Some ()
| _ -> None
module Make (N : NAME) (T : LOGIN_TEMPLATES) : AUTH_HANDLERS = struct
......
......@@ -29,13 +29,10 @@ type config = { db : string }
let name = "password"
let parse_config ~instance ~attributes =
let parse_config ~attributes =
match attributes with
| ["db", db] -> {db}
| _ ->
Printf.ksprintf failwith
"invalid configuration for instance %s of auth/%s"
instance name
| ["db", db] -> Some {db}
| _ -> None
module type CONFIG = sig
val db : string
......
......@@ -75,7 +75,15 @@ module Make (N : NAME) = struct
) else (
let auth_system = Hashtbl.find auth_systems name in
let module X = (val auth_system : AUTH_SYSTEM) in
let config = X.parse_config ~instance ~attributes in
let config =
match X.parse_config ~attributes with
| Some x -> x
| None ->
Printf.ksprintf
failwith
"invalid configuration for instance %s of auth/%s"
instance X.name
in
let auth = X.make config in
let module N = struct
let name = instance
......
......@@ -204,9 +204,8 @@ module type AUTH_SYSTEM = sig
val name : string
val parse_config :
instance:string ->
attributes:(string * string) list ->
config
config option
val make : config -> (module AUTH_SERVICE)
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment