diff --git a/src/app.ml b/src/app.ml index 62f722f..eeca88b 100644 --- a/src/app.ml +++ b/src/app.ml @@ -42,6 +42,14 @@ let open_registration = let () = Dream.log "open_registration: %b" open_registration +let hostname = + match Scfg.Query.get_dir "hostname" config with + | None -> failwith "no `hostname` in configuration file" + | Some hostname -> + Result.fold ~error:failwith ~ok:Fun.id (Scfg.Query.get_param 0 hostname) + +let () = Dream.log "hostname: %s" hostname + let port = match Scfg.Query.get_dir "port" config with | None -> 8080 diff --git a/src/pp_babillard.ml b/src/pp_babillard.ml index 4dfc3ad..ba82c27 100644 --- a/src/pp_babillard.ml +++ b/src/pp_babillard.ml @@ -272,9 +272,6 @@ let get_markers () = in Ok markers -(* TODO get from config file? *) -let server_url = "http://localhost:3696" - (* RFC-3339 date-time *) let pp_date fmt date = let date = Unix.gmtime date in @@ -285,7 +282,7 @@ let pp_feed_entry fmt post = Format.fprintf fmt {| - Atom-Powered Robots Run Amok + urn:uuid:%s %a @@ -297,7 +294,7 @@ let pp_feed_entry fmt post = |} post.id pp_date post.date post.nick (Dream.html_escape post.comment) - server_url post.parent_id post.id + App.hostname post.parent_id post.id let feed thread_id = let* thread_data, op_post = get_op thread_id in @@ -308,12 +305,11 @@ let feed thread_id = let entries fmt () = (Format.pp_print_list ~pp_sep:Format.pp_print_space pp_feed_entry) fmt posts in - (*TODO different uuid for op and thread ..?*) let feed = Format.asprintf {| - %s | Permap + %s %a @@ -321,9 +317,8 @@ let feed thread_id = urn:uuid:%s %a - - |} - thread_data.subject server_url thread_id pp_date last_update op_post.nick - op_post.id entries () +|} + thread_data.subject App.hostname thread_id pp_date last_update + op_post.nick op_post.id entries () in Ok feed