aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2023-12-20 20:43:25 -0600
committerMarc Coquand <marc@mccd.space>2023-12-20 20:43:25 -0600
commitcc783c157f31e7e713c8b83be67449b1859dac27 (patch)
tree52559c115159671839f4b497b9191222faa35520 /bin
downloadfixgen-cc783c157f31e7e713c8b83be67449b1859dac27.tar.gz
fixgen-cc783c157f31e7e713c8b83be67449b1859dac27.tar.bz2
fixgen-cc783c157f31e7e713c8b83be67449b1859dac27.zip
Initial commit
Diffstat (limited to '')
-rw-r--r--bin/dune5
-rw-r--r--bin/main.ml19
2 files changed, 24 insertions, 0 deletions
diff --git a/bin/dune b/bin/dune
new file mode 100644
index 0000000..62d69ee
--- /dev/null
+++ b/bin/dune
@@ -0,0 +1,5 @@
+(executable
+ (public_name ann_bloop)
+ (name main)
+ (libraries ann_bloop uri dream)
+ (preprocess (pps lwt_ppx ppx_yojson_conv ppx_inline_test)))
diff --git a/bin/main.ml b/bin/main.ml
new file mode 100644
index 0000000..2ed3595
--- /dev/null
+++ b/bin/main.ml
@@ -0,0 +1,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!")
+ ]