-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.ml
48 lines (37 loc) · 1.14 KB
/
config.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
open Mirage
(** Custom bootvars *)
(** Default language *)
let bootvar_lang =
let i = Key.Arg.info
~doc:"Default language for the page served by the unikernel." ["lang"]
in
Key.create "lang" Key.Arg.(opt string "en" i)
(** Consider headers *)
let bootvar_use_headers =
let i = Key.Arg.info
~doc:"Use headers to determine the language of the website visitor."
["use-header"]
in
Key.create "use_headers" Key.Arg.(opt bool true i)
(* Network configuration *)
let stack = generic_stackv4 default_console tap0
(* storage configuration *)
let data = direct_kv_ro "./static"
let keys = direct_kv_ro "./secrets"
(* Dependencies *)
let server =
foreign "Dispatch.Make"
(console @-> clock @-> kv_ro @-> kv_ro @-> http @-> job)
let my_https =
http_server @@ conduit_direct ~tls:true stack
let () =
let libraries = [ "sequence" ; "containers" ; "tyxml" ] in
let packages = [ "sequence" ; "containers" ; "tyxml" ] in
register "No"
~libraries
~packages
~keys:[
Key.abstract bootvar_lang ;
Key.abstract bootvar_use_headers ;
]
[ server $ default_console $ default_clock $ data $ keys $ my_https ]