aboutsummaryrefslogtreecommitdiff
path: root/bin/main.ml
blob: 2ed35955b913e52db9bb5cd1053340519ef3827f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
open Ann_bloop

let () =
  let port =
    Sys.getenv_opt "PORT" |> Option.map int_of_string
    |> Option.value ~default:8080
  in
  let env = Sys.getenv_opt "ENV" |> Option.value ~default:"PROD" in
  let disable_auth =
    Sys.getenv_opt "DISABLE_AUTH" |> Option.value ~default:"false"
  in
  let interface = if env = "DEV" then "localhost" else "0.0.0.0" in
  Dream.run ~port ~interface @@ Dream.logger
  @@ Dream.router
       [
         Dream.get "/actor" (fun _ ->
             Dream.log "Sending actor";
             Dream.html "Hello world!")
       ]