profile
viewpoint

voicerepublic/voicerepublic_dev 366

VoiceRepublic https://voicerepublic.com

jerben/clj-2048-ai 8

Solving 2048 using expectimax and Clojure.

jerben/memb 4

A tiny cli tool for managing a local text-based knowledge base.

jerben/clj-aws-sign 3

A clojure implementation of the AWS Signature Version 4 algorithm provided as easy-to-use library.

jerben/linked-data-driven-ui 3

A linked data driven UI for task based computing

jerben/bfbc2-stats 2

A stats system for Battlefield Bad Company 2, created and maintained by DU4.

jerben/pillowboard 2

Zero config data-driven dashboard for developers

jerben/issuetracker 1

This is an issue tracker made during the course WEB3 at ZHAW.

jerben/playground 1

This is a repo of random stuff I did that are not worth a whole repo.

push eventoxidizing/sihl

Josef Erben

commit sha c62c343d9647e0be1a577d220b1ee0fa5256ef58

Change "start" command to support automatically run migrations We will need this for instance when doing CD and migrations from CI.

view details

push time in 6 hours

push eventoxidizing/sihl

Josef Erben

commit sha 281cf45b717f756f3ee6e6194077c600bbbc3418

Change "start" command to support automatically run migrations We will need this for instance when doing CD and migrations from CI.

view details

push time in 6 hours

push eventoxidizing/sihl

Josef Erben

commit sha 6d97609a3e3d8aeb2f253b15154dd2b3865395c5

Change "start" command to support automatically run migrations We will need this for instance when doing CD and migrations from CI.

view details

push time in 6 hours

push eventoxidizing/sihl

Josef Erben

commit sha 0609573fe4e0cd7bf500c6f531fe7e01b2d50d8e

Change "start" command to support automatically run migrations We will need this for instance when doing CD and migrations from CI.

view details

push time in 6 hours

startedmirage/ca-certs

started time in 6 hours

issue closedoxidizing/sihl

Make sure email is not case sensitive when user signs up

When creating/registering a user using the user service, the email should be lowercased.

closed time in 6 hours

jerben

issue commentoxidizing/sihl

Make sure email is not case sensitive when user signs up

Fixed.

jerben

comment created time in 6 hours

push eventoxidizing/sihl

Josef Erben

commit sha 2429faa49cc134492436a74d5476a71ae32b2ba7

Use a URI safe base64 alphabet, so we don't need extra encoding

view details

push time in 10 hours

push eventoxidizing/sihl

Josef Erben

commit sha 402f49920a17cfda3f4e261bd462bf985dcf7669

Add default env config provider

view details

push time in 11 hours

push eventoxidizing/sihl

Josef Erben

commit sha fe92c24e30562a4e81b6337f05179939d8316235

Use TEXT to store job input in mariadb

view details

push time in 2 days

push eventoxidizing/sihl

Josef Erben

commit sha 5a2578b0970e8974a8b38b0687db2442c27285f5

Remove warning for non-existing CSRF middleware

view details

push time in 2 days

pull request commentoxidizing/sihl

Make email addresses case insensitive

Looks good!

aronerben

comment created time in 2 days

created tagoxidizing/sihl

tag0.0.46

A web framework for Reason & OCaml 🌊

created time in 2 days

Pull request review commentoxidizing/letters

Feature/refactor api around use of exceptions

 let certs_of_pem_directory ?(ext = "crt") path = let now () = Some (Ptime_clock.now ())  let build_email ~from ~recipients ~subject ~body =-  let open Mrmime in-  let subject = Unstructured.Craft.v subject in-  let date = Date.of_ptime ~zone:Date.Zone.GMT (Ptime_clock.now ()) in-  let from_addr =-    match Mailbox.of_string from with-    | Ok v -> v-    | Error _ -> failwith "Invalid email address for 'from'"-  in-  let to_addresses = List.filter_map to_recipient_to_address recipients in-  let cc_addresses = List.filter_map cc_recipient_to_address recipients in-  let headers =-    [-      Field.(Field (Field_name.subject, Unstructured, subject));-      Field.(Field (Field_name.date, Date, date));-      Field.(Field (Field_name.from, Mailbox, from_addr));-      Field.(Field (Field_name.v "To", Addresses, to_addresses));-      Field.(Field (Field_name.cc, Addresses, cc_addresses));-    ]-  in-  let plain_text_headers =-    let content1 =-      let open Content_type in-      make `Text-        (Subtype.v `Text "plain")-        Parameters.(of_list [ (k "charset", v "utf-8") ])+  try+    let open Mrmime in+    let subject = Unstructured.Craft.v subject in+    let date = Date.of_ptime ~zone:Date.Zone.GMT (Ptime_clock.now ()) in+    let from_addr =+      match Mailbox.of_string from with+      | Ok v -> v+      | Error _ -> raise (Invalid_email_address from)     in-    Header.of_list-      Field.-        [-          Field (Field_name.content_type, Content, content1);-          Field (Field_name.content_encoding, Encoding, `Quoted_printable);-        ]-  in-  let html_headers =-    let content1 =-      let open Content_type in-      make `Text-        (Subtype.v `Text "html")-        Parameters.(of_list [ (k "charset", v "utf-8") ])+    let to_addresses = List.filter_map to_recipient_to_address recipients in+    let cc_addresses = List.filter_map cc_recipient_to_address recipients in+    let headers =+      [+        Field.(Field (Field_name.subject, Unstructured, subject));+        Field.(Field (Field_name.date, Date, date));+        Field.(Field (Field_name.from, Mailbox, from_addr));+        Field.(Field (Field_name.v "To", Addresses, to_addresses));+        Field.(Field (Field_name.cc, Addresses, cc_addresses));+      ]     in-    Header.of_list-      Field.-        [-          Field (Field_name.content_type, Content, content1);-          Field (Field_name.content_encoding, Encoding, `Quoted_printable);-        ]-  in-  let body =-    match body with-    | Plain text -> Mt.part ~header:plain_text_headers (stream_of_string text)-    | Html text -> Mt.part ~header:html_headers (stream_of_string text)-  in-  Mt.make (Mrmime.Header.of_list headers) Mt.simple body+    let plain_text_headers =+      let content1 =+        let open Content_type in+        make `Text+          (Subtype.v `Text "plain")+          Parameters.(of_list [ (k "charset", v "utf-8") ])+      in+      Header.of_list+        Field.+          [+            Field (Field_name.content_type, Content, content1);+            Field (Field_name.content_encoding, Encoding, `Quoted_printable);+          ]+    in+    let html_headers =+      let content1 =+        let open Content_type in+        make `Text+          (Subtype.v `Text "html")+          Parameters.(of_list [ (k "charset", v "utf-8") ])+      in+      Header.of_list+        Field.+          [+            Field (Field_name.content_type, Content, content1);+            Field (Field_name.content_encoding, Encoding, `Quoted_printable);+          ]+    in+    let body =+      match body with+      | Plain text -> Mt.part ~header:plain_text_headers (stream_of_string text)+      | Html text -> Mt.part ~header:html_headers (stream_of_string text)+    in+    Ok (Mt.make (Mrmime.Header.of_list headers) Mt.simple body)+  with+  | Invalid_email_address address -> Error (Printf.sprintf "Invalid email address: %s" address)+  | _ -> Error "Unexpected error while trying to build an email message"

I don't see the change in github

mikonieminen

comment created time in 3 days

Pull request review commentoxidizing/letters

Feature/refactor api around use of exceptions

 let certs_of_pem_directory ?(ext = "crt") path = let now () = Some (Ptime_clock.now ())  let build_email ~from ~recipients ~subject ~body =-  let open Mrmime in-  let subject = Unstructured.Craft.v subject in-  let date = Date.of_ptime ~zone:Date.Zone.GMT (Ptime_clock.now ()) in-  let from_addr =-    match Mailbox.of_string from with-    | Ok v -> v-    | Error _ -> failwith "Invalid email address for 'from'"-  in-  let to_addresses = List.filter_map to_recipient_to_address recipients in-  let cc_addresses = List.filter_map cc_recipient_to_address recipients in-  let headers =-    [-      Field.(Field (Field_name.subject, Unstructured, subject));-      Field.(Field (Field_name.date, Date, date));-      Field.(Field (Field_name.from, Mailbox, from_addr));-      Field.(Field (Field_name.v "To", Addresses, to_addresses));-      Field.(Field (Field_name.cc, Addresses, cc_addresses));-    ]-  in-  let plain_text_headers =-    let content1 =-      let open Content_type in-      make `Text-        (Subtype.v `Text "plain")-        Parameters.(of_list [ (k "charset", v "utf-8") ])+  try+    let open Mrmime in+    let subject = Unstructured.Craft.v subject in+    let date = Date.of_ptime ~zone:Date.Zone.GMT (Ptime_clock.now ()) in+    let from_addr =+      match Mailbox.of_string from with+      | Ok v -> v+      | Error _ -> raise (Invalid_email_address from)     in-    Header.of_list-      Field.-        [-          Field (Field_name.content_type, Content, content1);-          Field (Field_name.content_encoding, Encoding, `Quoted_printable);-        ]-  in-  let html_headers =-    let content1 =-      let open Content_type in-      make `Text-        (Subtype.v `Text "html")-        Parameters.(of_list [ (k "charset", v "utf-8") ])+    let to_addresses = List.filter_map to_recipient_to_address recipients in+    let cc_addresses = List.filter_map cc_recipient_to_address recipients in+    let headers =+      [+        Field.(Field (Field_name.subject, Unstructured, subject));+        Field.(Field (Field_name.date, Date, date));+        Field.(Field (Field_name.from, Mailbox, from_addr));+        Field.(Field (Field_name.v "To", Addresses, to_addresses));+        Field.(Field (Field_name.cc, Addresses, cc_addresses));+      ]     in-    Header.of_list-      Field.-        [-          Field (Field_name.content_type, Content, content1);-          Field (Field_name.content_encoding, Encoding, `Quoted_printable);-        ]-  in-  let body =-    match body with-    | Plain text -> Mt.part ~header:plain_text_headers (stream_of_string text)-    | Html text -> Mt.part ~header:html_headers (stream_of_string text)-  in-  Mt.make (Mrmime.Header.of_list headers) Mt.simple body+    let plain_text_headers =+      let content1 =+        let open Content_type in+        make `Text+          (Subtype.v `Text "plain")+          Parameters.(of_list [ (k "charset", v "utf-8") ])+      in+      Header.of_list+        Field.+          [+            Field (Field_name.content_type, Content, content1);+            Field (Field_name.content_encoding, Encoding, `Quoted_printable);+          ]+    in+    let html_headers =+      let content1 =+        let open Content_type in+        make `Text+          (Subtype.v `Text "html")+          Parameters.(of_list [ (k "charset", v "utf-8") ])+      in+      Header.of_list+        Field.+          [+            Field (Field_name.content_type, Content, content1);+            Field (Field_name.content_encoding, Encoding, `Quoted_printable);+          ]+    in+    let body =+      match body with+      | Plain text -> Mt.part ~header:plain_text_headers (stream_of_string text)+      | Html text -> Mt.part ~header:html_headers (stream_of_string text)+    in+    Ok (Mt.make (Mrmime.Header.of_list headers) Mt.simple body)+  with+  | Invalid_email_address address -> Error (Printf.sprintf "Invalid email address: %s" address)+  | _ -> Error "Unexpected error while trying to build an email message"

Use Printexc.to_string to stringify the exception, so we know what we went wrong.

mikonieminen

comment created time in 3 days

Pull request review commentoxidizing/letters

Feature/support multipart alternative body

+open Letters++let ( let* ) = Lwt.bind++let get_ethereal_account_details () =+  let open Yojson.Basic.Util in+  (* see the README.md how to generate the account file and the path+   * below is relative to the location of the executable under _build+   *)+  let json = Yojson.Basic.from_file "../../../ethereal_account.json" in+  let username = json |> member "user" |> to_string in+  let password = json |> member "pass" |> to_string in+  let smtp_node = json |> member "smtp" in+  let hostname = smtp_node |> member "host" |> to_string in+  let port = smtp_node |> member "port" |> to_int in+  let with_starttls = smtp_node |> member "secure" |> to_bool |> not in+  Lwt.return+    {+      sender = username;+      username;+      password;+      hostname;+      port = Some port;+      with_starttls;+      ca_dir = "/etc/ssl/certs";+    }++let test_send_plain_text_email config _ () =+  let recipients =+    [+      To "harry@example.com";+      To "larry@example.com";+      Cc "bill@example.com";+      Bcc "dave@example.com";+    ]+  in+  let subject = "Plain text test email" in+  let body =+    Plain {|+Hi there,++have you already seen the very cool new web framework written in ocaml:+https://github.com/oxidizing/sihl++Regards,+The team+|}+  in+  let message = build_email ~from:config.sender ~recipients ~subject ~body in+  let* res = send ~config ~recipients ~message in+  match res with Ok () -> Lwt.return () | Error msg -> failwith msg++let test_send_html_email config _ () =+  let recipients =+    [+      To "harry@example.com";+      To "larry@example.com";+      Cc "bill@example.com";+      Bcc "dave@example.com";+    ]+  in+  let subject = "HTML only test email" in+  let body =+    Html {|+<p>Hi there,</p>+<p>+  have you already seen the very cool new web framework written in ocaml:+  <a href="https://github.com/oxidizing/sihl">Sihl</a>+<p>+Regards,<br>+The team+</p>+|}+  in+  let message = build_email ~from:config.sender ~recipients ~subject ~body in+  let* res = send ~config ~recipients ~message in+  match res with Ok () -> Lwt.return () | Error msg -> failwith msg++let test_send_mixed_body_email config _ () =+  let recipients =+    [+      To "harry@example.com";+      To "larry@example.com";+      Cc "bill@example.com";+      Bcc "dave@example.com";+    ]+  in+  let subject = "Mixed body email with plain text and HTML" in+  let text = {|+Hi there,++have you already seen the very cool new web framework written in ocaml:+https://github.com/oxidizing/sihl++Regards,+The team+|}+  in+  let html = {|+<p>Hi there,</p>+<p>+  have you already seen the very cool new web framework written in ocaml:+  <a href="https://github.com/oxidizing/sihl">Sihl</a>+<p>+Regards,<br>+The team+</p>+|}+  in+  let message = build_email ~from:config.sender ~recipients ~subject ~body:(Mixed (text, html, None)) in

Imo this is too low level to expose it through the client API.

mikonieminen

comment created time in 3 days

Pull request review commentoxidizing/letters

Feature/support multipart alternative body

+open Letters++let ( let* ) = Lwt.bind++let get_ethereal_account_details () =+  let open Yojson.Basic.Util in+  (* see the README.md how to generate the account file and the path+   * below is relative to the location of the executable under _build+   *)+  let json = Yojson.Basic.from_file "../../../ethereal_account.json" in+  let username = json |> member "user" |> to_string in+  let password = json |> member "pass" |> to_string in+  let smtp_node = json |> member "smtp" in+  let hostname = smtp_node |> member "host" |> to_string in+  let port = smtp_node |> member "port" |> to_int in+  let with_starttls = smtp_node |> member "secure" |> to_bool |> not in+  Lwt.return+    {+      sender = username;+      username;+      password;+      hostname;+      port = Some port;+      with_starttls;+      ca_dir = "/etc/ssl/certs";+    }++let test_send_plain_text_email config _ () =+  let recipients =+    [+      To "harry@example.com";+      To "larry@example.com";+      Cc "bill@example.com";+      Bcc "dave@example.com";+    ]+  in+  let subject = "Plain text test email" in+  let body =+    Plain {|+Hi there,++have you already seen the very cool new web framework written in ocaml:+https://github.com/oxidizing/sihl++Regards,+The team+|}+  in+  let message = build_email ~from:config.sender ~recipients ~subject ~body in+  let* res = send ~config ~recipients ~message in+  match res with Ok () -> Lwt.return () | Error msg -> failwith msg++let test_send_html_email config _ () =+  let recipients =+    [+      To "harry@example.com";+      To "larry@example.com";+      Cc "bill@example.com";+      Bcc "dave@example.com";+    ]+  in+  let subject = "HTML only test email" in+  let body =+    Html {|+<p>Hi there,</p>+<p>+  have you already seen the very cool new web framework written in ocaml:+  <a href="https://github.com/oxidizing/sihl">Sihl</a>+<p>+Regards,<br>+The team+</p>+|}+  in+  let message = build_email ~from:config.sender ~recipients ~subject ~body in+  let* res = send ~config ~recipients ~message in+  match res with Ok () -> Lwt.return () | Error msg -> failwith msg++let test_send_mixed_body_email config _ () =+  let recipients =+    [+      To "harry@example.com";+      To "larry@example.com";+      Cc "bill@example.com";+      Bcc "dave@example.com";+    ]+  in+  let subject = "Mixed body email with plain text and HTML" in+  let text = {|+Hi there,++have you already seen the very cool new web framework written in ocaml:+https://github.com/oxidizing/sihl++Regards,+The team+|}+  in+  let html = {|+<p>Hi there,</p>+<p>+  have you already seen the very cool new web framework written in ocaml:+  <a href="https://github.com/oxidizing/sihl">Sihl</a>+<p>+Regards,<br>+The team+</p>+|}+  in+  let message = build_email ~from:config.sender ~recipients ~subject ~body:(Mixed (text, html, None)) in

Why do we expose the boundary through the API?

mikonieminen

comment created time in 3 days

startedmirage/mrmime

started time in 3 days

Pull request review commentoxidizing/letters

Guard letters.send from leaking exceptions

 let build_email ~from ~recipients ~subject ~body =   Mt.make (Mrmime.Header.of_list headers) Mt.simple body  let send ~config:c ~recipients:r ~message:m =-  let ( let* ) = Lwt.bind in-  let authentication : Sendmail.authentication =-    { username = c.username; password = c.password; mechanism = Sendmail.PLAIN }-  in-  let port =-    match (c.port, c.with_starttls) with-    | None, true -> 587-    | None, false -> 465-    | Some v, _ -> v-  in-  let mail = Mrmime.Mt.to_stream m in-  let from_mailbox =-    match Emile.of_string c.sender with-    | Ok v -> v-    | Error `Invalid -> failwith "Invalid sender address"-  in-  let from_addr =-    match Colombe_emile.to_reverse_path from_mailbox with-    | Ok v -> v-    | Error (`Msg msg) -> failwith msg-  in-  let recipients =-    List.map-      (fun recipient ->-        (match recipient with To a -> a | Cc a -> a | Bcc a -> a)-        |> str_to_colombe_address)-      r-  in-  let domain =-    match domain_of_reverse_path from_addr with-    | Ok v -> v-    | Error _ -> failwith "Failed to extract domain of sender address"-  in-  let hostname =-    match Domain_name.of_string c.hostname with-    | Error _ -> failwith "Config hostname is not valid hostname"-    | Ok hostname -> (-        match Domain_name.host hostname with-        | Error _ -> failwith "Config hostname is not valid hostname"-        | Ok hostname -> hostname )-  in-  let* certs =-    match Fpath.of_string c.ca_dir with-    | Ok path -> certs_of_pem_directory ~ext:"pem" path-    | Error _ -> failwith "Failed to open CA certificates directory"-  in-  let tls_authenticator = X509.Authenticator.chain_of_trust ~time:now certs in-  if c.with_starttls then-    let* res =-      Sendmail_handler.run_with_starttls ~hostname ~port ~domain ~authentication-        ~tls_authenticator ~from:from_addr ~recipients ~mail+  try+    let ( let* ) = Lwt.bind in+    let authentication : Sendmail.authentication =+      { username = c.username; password = c.password; mechanism = Sendmail.PLAIN }+    in+    let port =+      match (c.port, c.with_starttls) with+      | None, true -> 587+      | None, false -> 465+      | Some v, _ -> v+    in+    let mail = Mrmime.Mt.to_stream m in+    let from_mailbox =+      match Emile.of_string c.sender with+      | Ok v -> v+      | Error `Invalid -> failwith "Invalid sender address"+    in+    let from_addr =+      match Colombe_emile.to_reverse_path from_mailbox with+      | Ok v -> v+      | Error (`Msg msg) -> failwith msg     in-    match res with-    | Ok () -> Lwt.return (Ok ())-    | Error err ->+    let recipients =+      List.map+        (fun recipient ->+           (match recipient with To a -> a | Cc a -> a | Bcc a -> a)+           |> str_to_colombe_address)+        r+    in+    let domain =+      match domain_of_reverse_path from_addr with+      | Ok v -> v+      | Error _ -> failwith "Failed to extract domain of sender address"+    in+    let hostname =+      match Domain_name.of_string c.hostname with+      | Error _ -> failwith "Config hostname is not valid hostname"+      | Ok hostname -> (+          match Domain_name.host hostname with+          | Error _ -> failwith "Config hostname is not valid hostname"+          | Ok hostname -> hostname )+    in+    let* certs =+      match Fpath.of_string c.ca_dir with+      | Ok path -> certs_of_pem_directory ~ext:"pem" path+      | Error _ -> failwith "Failed to open CA certificates directory"+    in+    let tls_authenticator = X509.Authenticator.chain_of_trust ~time:now certs in+    if c.with_starttls then+      let* res =+        Sendmail_handler.run_with_starttls ~hostname ~port ~domain ~authentication+          ~tls_authenticator ~from:from_addr ~recipients ~mail+      in+      match res with+      | Ok () -> Lwt.return (Ok ())+      | Error err ->         Lwt.fail_with           (Fmt.str "Sending email failed, %a" Sendmail_with_tls.pp_error err)-  else-    let* res =-      Sendmail_handler.run ~hostname ~port ~domain ~authentication-        ~tls_authenticator ~from:from_addr ~recipients ~mail-    in-    match res with-    | Ok () -> Lwt.return (Ok ())-    | Error err ->+    else+      let* res =+        Sendmail_handler.run ~hostname ~port ~domain ~authentication+          ~tls_authenticator ~from:from_addr ~recipients ~mail+      in+      match res with+      | Ok () -> Lwt.return (Ok ())+      | Error err ->         Lwt.fail_with (Fmt.str "Sending email failed, %a" Sendmail.pp_error err)+  with+  | _ -> Lwt.fail_with "Unexpected internal failure"

This fails with an exception, if you want to return a Result.t you should use Lwt_result.fail

mikonieminen

comment created time in 3 days

issue openedoxidizing/sihl

Make sure email is not case sensitive when user signs up

When creating/registering a user using the user service, the email should be lowercased.

created time in 3 days

push eventoxidizing/sihl

Josef Erben

commit sha f82ec13b03e19493c1d079c2e65463c179cf60ab

Remove register_schedules, since we have Service.schedule

view details

push time in 5 days

push eventoxidizing/sihl

Josef Erben

commit sha 455543a495ef42e9fdd0acd2c3e30bc0968ba3b3

Making table creation idempotent

view details

push time in 5 days

push eventoxidizing/sihl

Josef Erben

commit sha acd90cdc747b120ebe0a88c0850a882508f6e7a5

Making table creation idempotent

view details

push time in 5 days

push eventoxidizing/sihl

Josef Erben

commit sha f6598d73f5346ee7795b9ceca32bbd6ee6a0b61e

Making table creation idempotent

view details

push time in 6 days

push eventoxidizing/sihl

Josef Erben

commit sha 75790d212e0464fc762bd90584244cbf44027a56

Only run job queue logic when amount of job_instances > 0

view details

push time in 6 days

push eventoxidizing/sihl

Josef Erben

commit sha 469f59a46fca09ec040d59d72e081b4046d501bf

Start app in app.ml

view details

Josef Erben

commit sha 0a59dfdf90c284a5c1e91d79fbd31f8f49b63385

Make "failed" handler in job optional

view details

push time in 6 days

push eventoxidizing/sihl

Josef Erben

commit sha 700fe4a7d3fe182d9ab4a109642b0864e015b22d

Add "every_hour" as possible schedule period

view details

push time in 7 days

push eventoxidizing/sihl

Josef Erben

commit sha b3388e8574fc3f6b484e8ff8214d12508f09e134

Add "every_hour" as possible schedule period

view details

push time in 7 days

push eventoxidizing/sihl

Josef Erben

commit sha 1c6f225a0852554c654f06c356a8be26d29351d1

Stop logging that frequently using "debug"

view details

push time in 7 days

push eventoxidizing/sihl

Josef Erben

commit sha a724101cafc8eede65f639de93ca12a4a4e52058

Make sure job queue migrations are executed before running the test

view details

push time in 7 days

delete branch oxidizing/sihl

delete branch : bugfix/prepare-statement-just-once

delete time in 7 days

push eventoxidizing/sihl

Josef Erben

commit sha 167b7c4237a733523cbd637373f3f918bd47365b

Extract request creation so it happens only once

view details

Josef Erben

commit sha cd33e2bb44a90d752469ba9811ea6686cbfa8fe0

Skip initializing of queue during test, so test cases can do that

view details

Josef Erben

commit sha f169df6323a242cc79370a13df37f8ff02df0849

Don't register prepared statement for migration queries

view details

Josef Erben

commit sha fe214183c36ce870a170adab5a868c658a7e1c9e

Merge pull request #182 from oxidizing/bugfix/prepare-statement-just-once Extract request creation so it happens only once

view details

push time in 7 days

push eventoxidizing/sihl

Josef Erben

commit sha f169df6323a242cc79370a13df37f8ff02df0849

Don't register prepared statement for migration queries

view details

push time in 7 days

push eventoxidizing/sihl

Josef Erben

commit sha cd33e2bb44a90d752469ba9811ea6686cbfa8fe0

Skip initializing of queue during test, so test cases can do that

view details

push time in 7 days

create barnchoxidizing/sihl

branch : bugfix/prepare-statement-just-once

created branch time in 7 days

push eventoxidizing/sihl

Josef Erben

commit sha 76cf678caa85c0b15491bdf451569e178d60317d

Pass in context containing db connection pool

view details

push time in 7 days

push eventoxidizing/sihl

Josef Erben

commit sha 591a4aca227bcd512c907cf3eafbda2358d078b6

Fix collation in mariadb storage backend

view details

Josef Erben

commit sha 49375d6e0b7465afd5a4e38cd0662cad5045f164

Fix connection leak by using one db connection on all migrations

view details

push time in 7 days

issue commentoxidizing/sihl

Evaluate the use of Cmdliner for commands

For now we are using the simple and stupid custom solution.

jerben

comment created time in 7 days

issue commentoxidizing/sihl

Create ExcelService

Fixed.

aronerben

comment created time in 7 days

issue closedoxidizing/sihl

Create ExcelService

  • Should be string list list -> excel file
  • Can use StorageService
  • LibreOffice: which minimal installation? what is input data? stdin? file?
  • LibreOffice exterior
  • https://github.com/andrenth/ocaml-mariadb/blob/master/opam for depetxs LibreOffice installation
  • https://ocsigen.org/lwt/3.2.1/api/Lwt_process to run a LO task async

closed time in 7 days

aronerben

issue closedoxidizing/sihl

Create CsvService

  • Should be string list list -> csv file
  • Can use StorageService
  • Refer to https://github.com/oxidizing/sihl/issues/159 if needed

closed time in 7 days

aronerben

issue commentoxidizing/sihl

Create CsvService

Fixed.

aronerben

comment created time in 7 days

issue closedoxidizing/sihl

Create PDFService

  • HTML to PDF and PDF Merging
  • html string -> html file -> pdf file using Pandoc
  • What are the Pandoc commands? stdin? file?
  • Refer to https://github.com/oxidizing/sihl/issues/159 for process execution

closed time in 7 days

aronerben

push eventoxidizing/sihl

Josef Erben

commit sha 8dfc2c979e3c7e38f624408f38a598e66a1fc4d2

Run migrations on a single connection FK checks are session scoped by default, so we can not use the pool.

view details

Josef Erben

commit sha c49611cbf16365ff26ae3c16e44bacf14d6a8ea8

Register create_admin command with user service

view details

push time in 7 days

push eventoxidizing/sihl

Josef Erben

commit sha 458df6295c5bb2e465efa30978757817d888c6f8

Stop running migrations on app start

view details

push time in 8 days

push eventoxidizing/sihl

Josef Erben

commit sha 236fe764d64c7142ec21ab258a72e781aeada200

Use singular in migration name

view details

push time in 8 days

push eventoxidizing/sihl

Josef Erben

commit sha abbe814eff208c2e2e0d0db5f1335801fa31acf3

Add command to run all migrations

view details

push time in 8 days

push eventoxidizing/sihl

Josef Erben

commit sha 45b7cc413cc652b717a1d78f2681035e987bcbe9

Add small ascii art when running Sihl without commands

view details

Josef Erben

commit sha 49520aa254b584bf725075318ab25e9780d63e27

Merge pull request #181 from oxidizing/feature/command-service-and-default-commands Add small ascii art when running Sihl without commands

view details

push time in 8 days

create barnchoxidizing/sihl

branch : feature/command-service-and-default-commands

created branch time in 8 days

delete branch oxidizing/sihl

delete branch : feature/command-service-and-default-commands

delete time in 9 days

push eventoxidizing/sihl

Josef Erben

commit sha a993722fcaee007fe568ec1f4e204c2e0b1df920

Implement cmd service and add default commands

view details

Josef Erben

commit sha 0f7ac67d6454b32217f00798e70fa30d3ad09ba3

Merge pull request #180 from oxidizing/feature/command-service-and-default-commands Implement cmd service and add default commands

view details

push time in 9 days

push eventoxidizing/sihl

Josef Erben

commit sha a993722fcaee007fe568ec1f4e204c2e0b1df920

Implement cmd service and add default commands

view details

push time in 9 days

create barnchoxidizing/sihl

branch : feature/command-service-and-default-commands

created branch time in 9 days

push eventoxidizing/sihl

Josef Erben

commit sha 0816623f5286849c8cd96532772747edd4c7dd26

Stop including Core.Ctx.t in command handlers, provide app start cmd

view details

push time in 9 days

push eventoxidizing/sihl

Josef Erben

commit sha fdd7d35beb06a9ca0fb6134166fdfc053f952ad0

Implement util functions to convert date strings from and to ptime

view details

push time in 10 days

delete branch oxidizing/sihl

delete branch : feature/support-html-and-text-content-in-email

delete time in 10 days

push eventoxidizing/sihl

Josef Erben

commit sha 303f60f1df2eeef1afc5750a5641beed481e0b71

Add support for text and html content in mails

view details

Josef Erben

commit sha e9bc6ef09db486f5a0c0f606feb3689ad5fc4892

Merge pull request #179 from oxidizing/feature/support-html-and-text-content-in-email Add support for text and html content in mails

view details

push time in 10 days

create barnchoxidizing/sihl

branch : feature/support-html-and-text-content-in-email

created branch time in 10 days

push eventoxidizing/sihl

Josef Erben

commit sha 3220933b564aba125885f0572c596f12b89022a3

Add param4 and param5 for convenience

view details

push time in 10 days

push eventoxidizing/sihl

Josef Erben

commit sha 5e8bd5c0d6790d2b546036ad3e147706519f7f89

Implement separate service for sending emails delayed and bulk sending

view details

Josef Erben

commit sha 354c8d81c2b5bc6cc9f8d1670b20d617b5bcbd07

Increase timeout for queue tests so it doesn't fail in CI

view details

Josef Erben

commit sha 02976fe079e49cdeac859a278cdc5ecd64c754b2

Merge pull request #178 from oxidizing/feature/delayed-email-service Delayed email sending

view details

push time in 10 days

PR merged oxidizing/sihl

Reviewers
Delayed email sending
+93 -23

0 comment

9 changed files

jerben

pr closed time in 10 days

push eventoxidizing/sihl

Josef Erben

commit sha 354c8d81c2b5bc6cc9f8d1670b20d617b5bcbd07

Increase timeout for queue tests so it doesn't fail in CI

view details

push time in 10 days

PR opened oxidizing/sihl

Delayed email sending
+91 -21

0 comment

9 changed files

pr created time in 11 days

push eventoxidizing/sihl

Josef Erben

commit sha 5e8bd5c0d6790d2b546036ad3e147706519f7f89

Implement separate service for sending emails delayed and bulk sending

view details

push time in 11 days

create barnchoxidizing/sihl

branch : feature/delayed-email-service

created branch time in 11 days

push eventoxidizing/sihl

Josef Erben

commit sha f3214a279d833ccf2c1bec6155d321adf74246fb

Define API of job queue

view details

Josef Erben

commit sha 745960d3ad1ec7a22a8114d1b48f0b6f5b45bc4e

Implement initial version of queue service

view details

Josef Erben

commit sha acd412b49d340c15e435c3ec47c159383bd1bec7

Implement in-memory queue backend

view details

Josef Erben

commit sha 8f460c5f5484695f32442cc335304da1bff87c35

Add unit tests to check if given job can be run

view details

Josef Erben

commit sha 07afce89c13f2224d8c40f54080f0a8f951bfa0d

Define final queue API and catch exceptions in failure handler

view details

Josef Erben

commit sha 5b3bea05d0fb8bf0795a2c4bd43e6db51ef8a332

Split up tests and unit test job queue

view details

Josef Erben

commit sha 797195c5da72c43de48560015fc1f10d8df4404f

Implement job executing using scheduler

view details

Josef Erben

commit sha 3ef1a628004131688881af31215ec8b60ed7dbf4

Move database dependencies from email service into email repo

view details

Josef Erben

commit sha a4025656c0aed36006d60d1f3faf80cd292bcb30

Move database dependencies from session service to repo

view details

Josef Erben

commit sha 96e80c4a00c80a1f2cf0783d9b882e8975dbe71a

Move database dependencies from token service to repo

view details

Josef Erben

commit sha 1b22d31932e70953ad90a4fac219227f20141f3f

Move database dependencies from queue service to repo

view details

Josef Erben

commit sha 235b67970c4d2f31c82c0b182576ade0fd20583c

Remove all database related stuff from services We do this so we can use repositories that don't use caqti's API like custom in-memory repos for testing.

view details

Josef Erben

commit sha a0cfcad112356f4f0a0acc371a2533d8fec34c8b

Fix in-memory queue test

view details

Josef Erben

commit sha 6f117bc32e3df1fa588666ef5390153f079b4ca0

Catch and log exceptions thrown in scheduled functions

view details

Josef Erben

commit sha c804ebb420c19c61b805a6e1e0ded46951508ba8

Add API to job queue to provide custom context per job type

view details

Josef Erben

commit sha 14424e6d57f2514b0d7298bd3f2db2b168f60444

Add failing test for customizing request context

view details

Josef Erben

commit sha f30983530a398872b9e24ca9b8c7479d0d50c227

Add label to schedule for debugging purposes

view details

Josef Erben

commit sha 976140831952d047433e64115735bd00fae15a75

Make schedules stoppable, call stop schedule in on_stop in polling queue

view details

Josef Erben

commit sha 81516e8f06f607c1400cc63c3247a7cf35d8814e

Enable jobs to define the context they need to be called with

view details

Josef Erben

commit sha b38723cb786de3f6fdbde3e0dfae50f71a49176e

Get rid of Obj.magic and store WorkableJob.t

view details

push time in 11 days

delete branch oxidizing/sihl

delete branch : feature/job-queue-service

delete time in 11 days

PR merged oxidizing/sihl

Job Queue Service
+1527 -633

0 comment

45 changed files

jerben

pr closed time in 11 days

issue closedoxidizing/sihl

Implement SMTP client

We have following options:

  1. We try to use async_smtp and see if there are issues with running Lwt at the same time
  2. We bind to some C SMTP library and either use callbacks or spawn a new process
  3. We bind to some Rust SMTP library and either use callbacks or spawn a new process
  4. We vendor a small SMTP CLI binary and spawn new process with Lwt, communicate async

closed time in 11 days

jerben

issue commentoxidizing/sihl

Implement SMTP client

Fixed with https://github.com/oxidizing/letters

jerben

comment created time in 11 days

push eventoxidizing/sihl

Josef Erben

commit sha 325f535f54847e434c0cde9c0f2caf317b88dce2

Filter jobs to run in in-memory repo

view details

Josef Erben

commit sha 645e41459c026998c84540643aa671f140e6148a

Implement MariaDB repository for Job Queue

view details

push time in 11 days

push eventoxidizing/sihl

Josef Erben

commit sha d50ca8e91dacecbcfd93a646ac72a0880f88bac5

Make job input optional

view details

push time in 11 days

push eventoxidizing/sihl

Josef Erben

commit sha f5afbda3ce316df8ff547a5af1bd46de5b82bb0d

Store information about job scheduling in job instance This takes slightly more storage, but it also enables us to do filtering in the repository where it is most efficient.

view details

push time in 11 days

push eventoxidizing/sihl

Josef Erben

commit sha b38723cb786de3f6fdbde3e0dfae50f71a49176e

Get rid of Obj.magic and store WorkableJob.t

view details

push time in 11 days

push eventoxidizing/sihl

Josef Erben

commit sha 05a2eb5655cf542c4ecd0692b422b5a70d4e0497

Get rid of Obj.magic and store WorkableJob.t

view details

push time in 11 days

push eventoxidizing/sihl

Josef Erben

commit sha 81516e8f06f607c1400cc63c3247a7cf35d8814e

Enable jobs to define the context they need to be called with

view details

push time in 11 days

push eventoxidizing/sihl

Josef Erben

commit sha 976140831952d047433e64115735bd00fae15a75

Make schedules stoppable, call stop schedule in on_stop in polling queue

view details

Josef Erben

commit sha de169a6193a04b780dd1abdc189a113e9375c36a

Enable jobs to define the context they need to be called with

view details

push time in 11 days

push eventoxidizing/sihl

Josef Erben

commit sha f30983530a398872b9e24ca9b8c7479d0d50c227

Add label to schedule for debugging purposes

view details

push time in 12 days

push eventoxidizing/sihl

Josef Erben

commit sha 14424e6d57f2514b0d7298bd3f2db2b168f60444

Add failing test for customizing request context

view details

push time in 13 days

push eventoxidizing/sihl

Josef Erben

commit sha c804ebb420c19c61b805a6e1e0ded46951508ba8

Add API to job queue to provide custom context per job type

view details

push time in 13 days

push eventoxidizing/sihl

Josef Erben

commit sha 6f117bc32e3df1fa588666ef5390153f079b4ca0

Catch and log exceptions thrown in scheduled functions

view details

push time in 13 days

push eventoxidizing/sihl

Josef Erben

commit sha a0cfcad112356f4f0a0acc371a2533d8fec34c8b

Fix in-memory queue test

view details

push time in 13 days

push eventoxidizing/sihl

Josef Erben

commit sha 3ef1a628004131688881af31215ec8b60ed7dbf4

Move database dependencies from email service into email repo

view details

Josef Erben

commit sha a4025656c0aed36006d60d1f3faf80cd292bcb30

Move database dependencies from session service to repo

view details

Josef Erben

commit sha 96e80c4a00c80a1f2cf0783d9b882e8975dbe71a

Move database dependencies from token service to repo

view details

Josef Erben

commit sha 1b22d31932e70953ad90a4fac219227f20141f3f

Move database dependencies from queue service to repo

view details

Josef Erben

commit sha 235b67970c4d2f31c82c0b182576ade0fd20583c

Remove all database related stuff from services We do this so we can use repositories that don't use caqti's API like custom in-memory repos for testing.

view details

push time in 13 days

push eventoxidizing/sihl

Josef Erben

commit sha 5b3bea05d0fb8bf0795a2c4bd43e6db51ef8a332

Split up tests and unit test job queue

view details

Josef Erben

commit sha 797195c5da72c43de48560015fc1f10d8df4404f

Implement job executing using scheduler

view details

push time in 13 days

push eventoxidizing/sihl

Josef Erben

commit sha 07afce89c13f2224d8c40f54080f0a8f951bfa0d

Define final queue API and catch exceptions in failure handler

view details

push time in 14 days

push eventoxidizing/sihl

Josef Erben

commit sha 8f460c5f5484695f32442cc335304da1bff87c35

Add unit tests to check if given job can be run

view details

push time in 14 days

push eventoxidizing/sihl

Josef Erben

commit sha acd412b49d340c15e435c3ec47c159383bd1bec7

Implement in-memory queue backend

view details

push time in 14 days

issue closedoxidizing/sihl

Extend sihl_email to support queuing

  let email_templates =
    Sihl.Repo.Migration.Mariadb.migrate(
      "
CREATE TABLE IF NOT EXISTS `email_templates` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` binary(16) NOT NULL,
  `template_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `content_text` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `content_html` text COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_uuid` (`uuid`)
       ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;",
    );

  let emails_to_send =
    Sihl.Repo.Migration.Mariadb.migrate(
      "
CREATE TABLE IF NOT EXISTS `emails_to_send` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` binary(16) NOT NULL,
  `recipient` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
  `subject` varchar(190) COLLATE utf8mb4_unicode_ci NOT NULL,
  `text` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `template` bigint(20) unsigned DEFAULT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `scheduled_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `html` text COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_uuid` (`uuid`),
  UNIQUE KEY `unique_entry` (`recipient`,`subject`,`text`(128)),
  KEY `template` (`template`),
  CONSTRAINT `emails_to_send_ibfk_1` FOREIGN KEY (`template`) REFERENCES `email_templates` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;",
    );

  let sent_emails =
    Sihl.Repo.Migration.Mariadb.migrate(
      "
CREATE TABLE IF NOT EXISTS `sent_emails` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` binary(16) NOT NULL,
  `recipient` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `subject` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `template` bigint(20) unsigned DEFAULT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_uuid` (`uuid`),
  KEY `template` (`template`),
  CONSTRAINT `sent_emails_ibfk_1` FOREIGN KEY (`template`) REFERENCES `email_templates` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
",
    );

closed time in 14 days

jerben

issue commentoxidizing/sihl

Extend sihl_email to support queuing

Fixed.

jerben

comment created time in 14 days

push eventoxidizing/sihl

Josef Erben

commit sha 745960d3ad1ec7a22a8114d1b48f0b6f5b45bc4e

Implement initial version of queue service

view details

push time in 14 days

PR opened oxidizing/sihl

Feature/job queue service
+222 -1

0 comment

6 changed files

pr created time in 14 days

more